Error in callback for watcher "options": "TypeError: Cannot read properties of null (reading 'level')"
return {
options: []
}
methods: {
reload{
this.options = [];
getOptionsData.then((res) => {
this.options.push(res);
});
}
}
解决方案
1.后端传过来的数据可以临时保存到一个数组对象,然后在赋给options
return {
options: []
}
methods: {
methods: {
reload{
let optionsTemp = [];
getOptionsData.then((res) => {
optionsTemp.push(res);
this.options = optionsTemp;
});
}
}
}