写过的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) }) } }


 
原文地址:https://www.cnblogs.com/geekjsp/p/10009476.html