I am looking to utilize the vue-chartkick plugin in my Vue application, but I want to register it within my single-file components instead of globally. Is there a way to achieve this same functionality without using
Vue.use(VueChartkick, { Chartkick })
? I have attempted to import the plugin and register it as a component, but I keep receiving an error stating that the component is not defined. Below is the code snippet from my single-file component:
<template lang="pug" >
div
area-chart(:data="monthlyRevenue")
</template>
<script>
import Api from '../../../api';
import Chartkick from 'chartkick';
import VueChartkick from 'vue-chartkick'
import Chart from 'chart.js';
export default {
name: 'reporting',
components: {
'area-chart': AreaChart
},
data() {
return {
monthlyRevenue: {}
}
},
created() {
Api.get(window.location.pathname)
.then((response) => {
this.monthlyRevenue = response.body;
})
.catch((response) => {
this.handleErrors(response.body);
});
}
}
</script>