因为你将从username是从vuex中获取的,你又双向把绑定到了页面上,但是从计算属性方面只获取操作,没有赋值操作,加上就ok。
computed: { username:{ get(){ return this.$store.state.username }, set(val){ this.$store.commit('setUsername', val) } } }
因为你将从username是从vuex中获取的,你又双向把绑定到了页面上,但是从计算属性方面只获取操作,没有赋值操作,加上就ok。
computed: { username:{ get(){ return this.$store.state.username }, set(val){ this.$store.commit('setUsername', val) } } }
转载于:https://www.cnblogs.com/ps0327/p/11230590.html