[Vue warn]: Property "$pinia" was accessed during render but is not defined on instance #2331
-
ReproductionN/A Steps to reproduce the bugto use mapState with the following code, browser(Microsoft Edge) console print warning msg: runtime-core.esm-bundler.js:41 [Vue warn]: Property "$pinia" was accessed during render but is not defined on instance. at | get | @ | runtime-core.esm-bundler.js:2971 store/storage.js:
components/SourcePage.vue
Expected behavioraccess mapState should not print warning msg Actual behavioraccess mapState print warning msg Additional informationsome packages version: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
finally, I got it resolved(but not know the reason :) ). for quasar, it need a file src/stores/index.js to do pinia initialization
(https://quasar.dev/quasar-cli-vite/state-management-with-pinia/) But it is still puzzled that why the data is retrieved successfully with the warning "$pinia" is not defined. |
Beta Was this translation helpful? Give feedback.
-
I had a similar error, but had installed pinia as a plugin. But apparently the order of app.add({library}) calls matters. I had been using vueApp.add(pinia);
vueApp.add(router);
vueApp.mount("#app"); Switching the order of vueApp.add(router);
vueApp.add(pinia);
vueApp.mount("#app"); |
Beta Was this translation helpful? Give feedback.
finally, I got it resolved(but not know the reason :) ).
for quasar, it need a file src/stores/index.js to do pinia initialization
(https://quasar.dev/quasar-cli-vite/state-management-with-pinia/)
But it is still puzzled that …