就是需要在实例化一下,因为在编译router的时候pinia还未被实例化。
javascript
import { mainStore, useStore } from "@/store";
import { createApp } from 'vue'
import App from '../../App.vue'
import { createPinia } from "pinia";
const pinia = createPinia()
const app = createApp(App)
app.use(pinia)
const store = mainStore();
console.log('zxc', store.msg)