看了vuex會(huì)取值,但是不會(huì)存值,大佬能給個(gè)小demo學(xué)習(xí)一下,謝謝啦
1 回答

眼眸繁星
TA貢獻(xiàn)1873條經(jīng)驗(yàn) 獲得超9個(gè)贊
store.js:
state:{
value:''
}
mutations:{
changeValue(state,newVal){ state.value=newVal }
}
.vue:
//存this.$store.commit('changeValue',1)//取console.log(this.$store.state.value)//1
添加回答
舉報(bào)
0/150
提交
取消