getActivePinia was called with no active Pinia. Did you forget to install pinia? const pinia = createPinia()
时间: 2023-10-25 15:28:26 浏览: 124
getActivePinia was called with no active Pinia. Did you forget to install pinia? 这个错误通常发生在使用Pinia时忘记正确安装它的情况下。在代码引用中,你使用了createPinia()函数创建了一个Pinia实例。确保在你的应用的入口文件(一般是main.ts或main.js)中使用app.use(pinia)将Pinia实例挂载到Vue应用中,就像这样:app.use(pinia)。这样就会正确地安装和激活Pinia实例,避免出现getActivePinia错误。请检查你的入口文件确保正确安装了Pinia实例。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [vue3 + pinia 路由守卫中使用store 报错pinia未挂载注册的解决方法](https://blog.csdn.net/weixin_44253490/article/details/126968750)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [pinia报错:getActivePinia was called with no active Pinia. Did you forget to install pinia?](https://blog.csdn.net/qq_37291367/article/details/129195604)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文