使用echarts图表时,js报错,Uncaught (in promise) TypeError: Cannot read property 'getAttribute' of null

img

使用echarts图表时,js报错,Uncaught (in promise) TypeError: Cannot read property 'getAttribute' of null

这个错误是指 调用为这个getAttribute属性的对象是 null
比如你的代码是 obj.getAttribute
obj变量的值是 null
这种情况一般是因为用document.getElementById("id")没有获取到dom对象

你的dom元素加载上了吗看一下