vue3+ts+vuex,我在state里定义了一个对象数组,proxy里有内容但是把它从里面取出来数组内容就为0了,为什么呢?
const state = {
//state中数据默认初始值别瞎写
userInfo: []
};
const mutations = {
ACTIVELIST(state: any, userInfo: []) {
state.userInfo = userInfo;
console.log(userInfo)
}
};
//actions书写自己的业务逻辑
const actions = {
async getManager({ commit }: any) {
let result = await Manager();
//console.log(result.data);
if (result.code == 0) {
commit("ACTIVELIST", result.data);
}
}
};