"getActivePinia()" was called but there was no active Pinia. Did you forget to install pinia? const pinia = createPinia()
时间: 2023-10-25 15:01:26 浏览: 135
14.(vue3.x+vite)组件间通信方式之pinia.rar
引用、和中提到的错误"getActivePinia() was called but there was no active Pinia. Did you forget to install pinia?"是由于在项目中没有正确安装和使用pinia库引起的。和提到了类似的问题和错误提示信息。该错误通常在使用pinia时出现,提示你忘记安装pinia或没有正确配置它。在你的代码中,你需要先创建一个pinia实例,然后才能调用getActivePinia()方法。在Vue3中,可以通过使用createPinia()函数创建一个pinia实例,然后在项目中正确安装和配置它,以便使用pinia的各种功能和API。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [[pinia]getActivePinia was called with no active Pinia. Did you forget to install pinia?](https://blog.csdn.net/qubes/article/details/130203597)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [vue3-getActivePinia was called with no active Pinia. Did you forget to install pinia?](https://blog.csdn.net/qq_32644987/article/details/125708215)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文