页面:
<el-input v-model="cPlaceholder"></el-input>
computed:{
cPlaceholder:{
get(){
return this.$store.state.currentInputFrom.placeholder
},
set(val){
this.$store.commit('setPlaceholder', val)
}
}
}
VUEX:
state: {
currentInputFrom:{
}
},
mutations: {
setPlaceholder(state, value){
state.currentInputFrom.placeholder = value
}
}
操作结果:
在页面这个输入框输入内容之后,VUE设置成功,但是页面上不显示
补充一下
补充一个新的发现,用原生的input可以实现,我这个是用了ui库的input