写过的bug

const actions={
updateUsername: ( { commit},value )=>{
console.log("actions updateUsername");
commit('updateUsername',value)
}
}
不能这样写{commit,value}


props传boolean 要用单引号
componen-title='false'
双引号会报错 Invalid prop: type check failed for prop "componenTitle". Expected Boolean, got String.

...mapActions传值

Vue组件
<input @keyup.enter="renovateName(listName)" type="text" v-model="input" placeholder="updateUsername" /> methods:{   ...mapActions(['updateUsername']),   renovateName:function(x){   this.updateUsername(x).then((data)=>{     console.log("Promise resolve:");   console.log(data)   })   } } store/index.js

const actions={ updateUsername: ( { commit},value )=>{ console.log("actions updateUsername"); console.log(value); return new Promise((resolve, reject) => { setTimeout(() => { commit('updateUsername',value); resolve("2131231") }, 1000) }) } }

 



 
posted @ 2018-11-23 19:55  haveProgress  阅读(114)  评论(0编辑  收藏  举报