考虑下面这段话
export default {
methods: {
...mapActions(["updateData", "resetData"]);
}
}
我想把一个参数传入被调用的函数中.我不知道如何在保留...mapAction()
次通话的情况下正确执行,因此不得不重写以下内容.
export default {
methods: {
// ...mapActions(["updateData", "resetData"])
updateData: function() { this.$store.dispatch("updateData", "names") },
resetData: function() { this.$store.dispatch("resetData"); }
}
}
这是唯一的办法吗?