I have an issue when trying to access component functions from within the config of plugins. For example, I would like to use vue-flatpickr as so:
mounted() {
this.flatpicker = flatpickr(this.$refs.dateInput, {
onChange(date) {
this.$emit("dateChanged", date);
}
});
}
However, I get an error
Uncaught TypeError: this.$emit is not a function
The problem is not only with emit but also with any function defined in the methods section as this points to the instance of the plugin. I realize this might not be an adequate approach, I am open to any suggestions!