mutation 必須同步,任何異步只能出現在 action 裏。
緣起:
// 更新操作
ClueLibApi.reportClueRecord(param)
.then(rs => {
clue.clueState = 1;
this.$emit("reStatistics", "");
this.$message({
type: "success",
message: "成功"
});
})
.catch(e => {
console.error(e);
this.$alert(e || "出錯");
})
.finally(() => this.setLoading(false));
},
在
this.setClueState(clue.id);中的this,就是把通過mapMutations,把方法映射爲本文件使用,
關於獲取list中某個符合條件的數據對象,使用lambda表達式