0
点赞
收藏
分享

微信扫一扫

成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance.


文章目录

  • ​​1、出现的问题​​
  • ​​2、问题原因​​
  • ​​3、错误代码还原​​
  • ​​4、解决方法​​
  • ​​5、成功解决​​

1、出现的问题

成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance._错误代码

2、问题原因

在创建store的时候、要先声明使用vuex。就是先后问题、使用顺序出现问题

3、错误代码还原

注意:在main.js中调整​​Vue.use(Vuex)​​​和​​import store from './store/index.js'​​的先后顺序是没有用的。原因是:代码的执行机制是先扫描这个文件,首先执行所有的import

成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance._错误代码_02


成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance._错误代码_03

4、解决方法

将​​Vue.use(Vuex)​​直接放在store/index.js文件中

成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance._vue.js_04

成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance._vue.js_05

5、成功解决

成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance._错误代码_06


成功解决:[vuex] must call Vue.use(Vuex) before creating a store instance._解决方法_07


举报

相关推荐

0 条评论