I would like to use the vue-chartkick plugin, but want to register it within my single-file components rather than using it globally. Is there a way to achieve the same as
Vue.use(VueChartkick, { Chartkick })
in a single-file component? I've tried to import the plugin and then registered it as a component, but it keeps on telling me that the according component was not defined. This is 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>
script...just check theWithout Yarn or Npmsection on chartkick.com/vue