美文网首页
v-model与store的使用

v-model与store的使用

作者: zdxhxh | 来源:发表于2019-09-28 20:39 被阅读0次

有时候,需要使用单向数据流绑定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}})
      }
  },
}

相关文章

网友评论

      本文标题:v-model与store的使用

      本文链接:https://www.haomeiwen.com/subject/cghdyctx.html