Vue2-vite optionsAPI not working #1019
-
ReproductionFollowing instructions on Pinia site to use Pinia with Vue 2 and vite and options API. get the following error in the console; found in ---> at src/components/HelloWorld.vue Steps to reproduce the behaviorUsing: matt-auckland/vite-vue2-starter template: HelloWorld.vue Ronincount {{ count }} double count {{ doubleCount }}
Increment
Reset
main.js const pinia = createPinia(); new Vue({ stores/count/js import { defineStore } from "pinia"; export const useCountStore = defineStore({
}, vscode terminal output
Port 3000 is in use, trying another one... vite v2.7.12 dev server running at:
ready in 1398ms. ^C
Port 3000 is in use, trying another one... vite v2.7.12 dev server running at:
ready in 1391ms. Expected behaviorIt works and the page displays the counter Actual behaviorBlank page with the above console error, despite the fact that the server has started succesfully Additional informationAdd any other context about the problem here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Solved.
This small key part is not written in the pinia documentation. |
Beta Was this translation helpful? Give feedback.
Solved.
Basically, you need to import compositionAPI and use it to start the app much like Vue3
This small key part is not written in the pinia documentation.
Should be added to pinia docs.
Funny how a discussion has stalled this long.