v-model与store的使用

2019-09-28  本文已影响0人  zdxhxh

有时候,需要使用单向数据流绑定store的state的业务场景,我们可以结合computed属性使用,绕开data属性

<el-input v-model="userAccountID" clearable placeholder="请输入用户ID"></el-input>

computed:{
  userAccountID: { 
      get(){ 
        return this.orderChannelParam.userAccountID
      },
      set(value){ 
        this.mergeModel({name:'orderChannelParam',value:{userAccountID:value}})
      }
  },
}

上一篇 下一篇

猜你喜欢

热点阅读