victorgarciaesgi / vue-chart-3

📊 A simple wrapper around Chart.js 3 for Vue 2 & 3

Home Page:https://vue-chart-3.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vue 2 composition API issue

GijsGoudzwaard opened this issue · comments

vue-chart-3 automatically registers the composition API on

Vue.use(VueComp);
Since it is loaded within vue chart I don't need to load it myself. But on pages where there isn't a chart I must load it manually. Because vue doesn't allow me to load it twice I must check on which page I am before loading the composition API and only load it on pages where there isn't a chart loaded. It would be better if the composition API was loaded manually instead of automatically. Then I can just load it once on initialisation without having to check on which page I am.

Hi! You're right I didn't though of that at all. I will update it and update the docs :)

Should be fixed on v2.0.3! added a warning message since it's a breaking change

I'm getting this error when I'm now manually loading the composition API. I can use the composition API on other pages where there are no charts, but when I load charts I get the error: Error in data(): "Error: [vue-composition-api] must call Vue.use(VueCompositionAPI) before using any function.". See the console in the demo I forked from your documentation

https://codesandbox.io/s/vue-chart-3-vue-2-forked-d82mz?file=/src/main.js

Ho sorry i'm looking at it right now

@GijsGoudzwaard Looks like a bug in @vue/composition-api. I upgraded the version to 1.4.1 and it works

https://codesandbox.io/s/vue-chart-3-vue-2-forked-e74e7?file=/src/App.vue

I will make an update to enforce this version

Got it working by updating @vue/composition-api to 1.4.1. Thanks for your help!

Hello,

Is there any way to remove the warning once taken in account?

Thanks

@augnustin The warning should be removed in the new version :)