[Vue warn]: Computed property "username" was assigned to but it has no setter.

因为你将从username是从vuex中获取的,你又双向把绑定到了页面上,但是从计算属性方面只获取操作,没有赋值操作,加上就ok。

computed: {
    username:{
        get(){
          return this.$store.state.username
        },
        set(val){
          this.$store.commit('setUsername', val)
        }
    }
}

 

posted @ 2018-03-15 15:11  潘多拉Pandora  阅读(1774)  评论(0)    收藏  举报