Vue.prototype.$store = store
时间: 2023-10-25 09:27:12 浏览: 74
在uni-app项目的main.js文件中,通过使用Vue.prototype方法,将一个可用于全局页面的变量$store挂载到Vue实例上。这里的store是从./store文件中导入的,并且是一个Vuex.Store的实例。通过这种方式,我们可以在任何页面中使用this.$store来访问和修改全局状态。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [main.js中Vue.prototype用于全局页面的变量](https://blog.csdn.net/weixin_42260975/article/details/117065830)[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_1"}}] [.reference_item style="max-width: 50%"]
- *3* [vue-简单的状态管理实现](https://blog.csdn.net/u012864281/article/details/107065593)[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_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文