一、通过this.$store.commit(“mutationsName”, “要改的值”)
去修改state值。
二、actions:
actions: {
actionsName({ commit }, parameter) {
return new Promise((resolve, reject) => {
setTimeout(() => {
if(parameter === "某个值") {
commit("mutationsName");
resolve();
} else {
reject();
}
}, 1000)
}
}
}
// 调用this.$store.dispatch('actionsName', "parameter");