1.引入
import Vuex from 'vuex'
2.use
vue.use(vuex)
3.实例化
let store=new Vuex.Store({
state:{},
getters:{},
mutations:{},
actions:{}
})
4.配置到vue实例
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
1.引入
import Vuex from 'vuex'
2.use
vue.use(vuex)
3.实例化
let store=new Vuex.Store({
state:{},
getters:{},
mutations:{},
actions:{}
})
4.配置到vue实例
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
本文标题:vue-cli中使用vuex的方式
本文链接:https://www.haomeiwen.com/subject/exzbtqtx.html
网友评论