【发布时间】:2020-12-24 07:35:39
【问题描述】:
使用 Vuex 4.0.0-beta.4,在我的商店中我有:
const state = {
flash: []
};
const mutations = {
PUSH_FLASH(state, payload) {
debugger;
state.flash.push(payload);
}
};
无论payload 是什么(无论是字符串、整数还是对象),我都会收到此错误:
Uncaught TypeError: Object(...) is not a function
这是完整的错误:
这在我从 Vue2 更新到 Vue3 后开始出现。我可能忘记更新 Vuex 的某些部分了吗?
【问题讨论】:
-
你的意思是
const state = { flash: [] }吗? -
@Psidom,抱歉,这只是我的问题中的一个错字。已更正,谢谢。