chartjs-plugin-datalabels
chartjs-plugin-datalabels copied to clipboard
Lazy loading the plugin nested in Vue 3 Script setup
I am trying to lazyload this plugin into my Vue3 script setup, like this:
const Vue3ChartJs = defineAsyncComponent(() => import('@j-t-mcc/vue3-chartjs'));
const ChartJsPluginDataLabels= defineAsyncComponent(() => import('chartjs-plugin-datalabels'));
The problem is that it that the datalabels plugin requires the chartjs to be there. Can you tell me how to load the label plugin after the load of the chartjs?
I could imagine something nested like:
const Vue3ChartJs = defineAsyncComponent(() => import("@j-t-mcc/vue3-chartjs").then(() =>
const ChartJsPluginDataLabels= defineAsyncComponent(() => import('chartjs-plugin-datalabels'));
));