[Vuejs]-GetEvents of undefined in created hook, Vue Kalendar plugin

0👍

I’ve never used this component before but a quick dig into the source finds this:

https://github.com/altinselimi/kalendar/blob/4b1a834b5945e4f61bca6e4e1f333114a0554c8a/src/components/kalendar/kalendar-container.vue#L230

So inside the created hook of kalendar-container.vue is:

this.$kalendar.getEvents = () => {

That ties up with the error message you’re seeing.

So the question is, where is $kalendar supposed to come from?

Further digging in the source finds it here:

https://github.com/altinselimi/kalendar/blob/4b1a834b5945e4f61bca6e4e1f333114a0554c8a/src/main.js#L6

Why it isn’t added within the plugin’s install function I have no idea but it would seem that you need to add it yourself with:

Vue.prototype.$kalendar = {};

Just from a couple of minutes looking at the source code I would be nervous about using this component in my own applications.

Leave a comment