Uncaught (in promise) TypeError: Cannot read property 'getAttribute' of null
程序员文章站
2022-06-07 13:18:10
...
原因:在实例化前打印console.log(document.getElementById('main')) 查看页面是否存在HTML元素
解决方案一:延迟加载
setTimeout(() => {
this.getChart();
}, 1000);
推荐阅读
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object
-
js报错 Cannot read property 'getAttribute' of null
-
Extjs4---Uncaught TypeError: Cannot read property ‘items’ of undefined
-
JavaScript Uncaught TypeError: Cannot read property 'value' of null
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#
-
el-tooltip组件中content使用Vue-i18n报错TypeError: Cannot read property ‘$t‘ of null
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object
-
ASP.NET MVC运行出现Uncaught TypeError: Cannot set property __MVC_FormValidation of null的解决方法
-
Vue引入echarts报错Error in mounted hook: “TypeError: Cannot read property ‘getAttribute‘ of null“
-
vue3 使用axios 会报错“Uncaught TypeError: Cannot read property ‘get‘ of undefined”