在setup外部使用时,在请求拦截时获取token时。会出现获取的token是上一次获取的token。出现这种情况是因为实例化了两个Pinia实例,
解决办法是在实例化一个Pinia实例,在store目录下index文件中创建Pinia实例,
import type {App} from 'vue';
import * as Pinia from 'pinia';
const store: any = Pinia.createPinia();
export function setupStore(app: App<Element>){
app.use(store);
}
export { store };
来自为知笔记(Wiz)
标签:setup,token,实例,Pinia,app,bug,store From: https://www.cnblogs.com/baiyifengyun/p/17812003.html