Error in nextTick: “TypeError: Cannot read properties of undefined (reading ‘getAttribute’)” 问题的解决
Error in nextTick: “TypeError: Cannot read properties of undefined (reading ‘getAttribute’)” 问题的解决
报错 Cannot read properties of undefined
解决方法:加一个判断if (表示dom已存在),再执行this.nextTick() 方法
if (this.$refs.chart) {
this.$nextTick(() => {
let chart3 = this.$refs.chart3;
vm.myChart3 = this.$echarts.init(chart3);
vm.myChart3.setOption(option, true);
});
}
本内容为PUDN经合法授权发布,文章内容为作者独立观点,不代表PUDN立场,未经允许不得转载。
转载于:https://www.pudn.com/news/6228d7099ddf223e1ad209f9.html