在router中使用pinia(getActivePinia was called with no active Pinia. Did you forget to install pinia)报错解决
新建store.js
import { createPinia } from 'pinia';
const pinia = createPinia();
export default pinia;
main.js 引入
import pinia from "@/store/store"
app.use(pinia)
外部js
cookie.js
import pinia from '@/store/store'
import { mainStore } from "@/store/mainStore"
const store = mainStore(pinia)
然后就可以随便调用了