动态加载vuex

作者: 裸泳的小熊 | 来源:发表于2020-07-13 15:07 被阅读0次

1、注册vuex

main.js
store/index.js

store下的index文件中只有state,module模块因为是动态加载,所以不直接写到index文件中。

2、写一个插件

写一个插件同时在main.js中用Vue.use()


plugin.js

3、增加动态导入的模块


helloWorld.js
在store/module/helloWorld.js
和组件内name同名。
helloWorld.vue

相关文章

网友评论

    本文标题:动态加载vuex

    本文链接:https://www.haomeiwen.com/subject/fqqacktx.html