chartjs-plugin-datalabels icon indicating copy to clipboard operation
chartjs-plugin-datalabels copied to clipboard

Lazy loading the plugin nested in Vue 3 Script setup

Open CasperNH opened this issue 2 years ago • 0 comments

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'));
));

CasperNH avatar Aug 23 '22 13:08 CasperNH