原文:echarts js報錯 Cannot read property 'getAttribute' of null

本文將為您描述如何解決 eharts.js報錯 Uncaught TypeError: Cannot read property getAttribute of null 的問題 根據報錯信息查找原因發現是因為 實例化 echarts 的元素不存在 未找到指定的元素 ,查看官方文檔發現: 基於准備好的 dom,初始化 echarts 實例,也就是只有頁面存在的HTML元素才可以去初始化。 解決方案 ...

2019-11-02 14:48 0 3435 推薦指數:

查看詳情

在vue中使用echarts報錯Cannot read property getAttribute of null

報錯信息如下: 報錯代碼: mounted() { // ... this.drwaCharts() // drawCharts方法為自己定義的包含渲染 echarts 圖表的方法 // ...} 之前一直用 echarts 沒有出現過這個問題,所以當這個問題出現時我就開始了各種查 ...

Fri Aug 21 00:54:00 CST 2020 1 1683
關於JS報錯Cannot read property 'getAttribute' of null問題

關於JS報錯Cannot read property 'getAttribute' of null問題 出錯原因 在vue中使用echarts時,在圖表元素並未加載的情況下進行eharts.init(),會發生此錯誤,因為eharts並未找到該元素,故無法對其進行渲染 ...

Sat Mar 14 00:12:00 CST 2020 0 1384
使用Echarts出現Cannot read property getAttribute of null問題

由於把echarts放到頁面的一個彈出框組件中,故在頁面初始化的過程中,charts這時候不在頁面節點中,就會導致這一問題,所以只需簡單的添加this.$nextTick(function(){})函數,將圖表初始化放到這個函數中就能解決問題 ...

Mon Jul 20 18:24:00 CST 2020 0 513
echarts Cannot read property 'getAttribute' of null 問題的解決方法

今天在使用echarts練習官方給的實例的時候,代碼沒有問題 卻總是報錯Cannot read property 'getAttribute' of null” 找了好久的文檔沒有看明白 。。。 最后終於發現造成這種錯誤的原因是 echarts.js引用放在head中或者放在 ...

Sat Oct 13 23:34:00 CST 2018 0 17647
在vue中引用echarts導致Cannot read property getAttribute of null ?

報錯信息如下: 之前一直用echarts沒有出現過這個問題,所以當這個問題出現時我就開始了各種查,試了幾種方法依舊報錯,比如: 1、在mounted() {},寫成如下形式:(依舊報錯) 2、(依舊報錯) 3、正確的方法 因為我在包裹echarts ...

Fri Aug 30 22:58:00 CST 2019 0 2115
Error:Cannot read property 'getAttribute' of null

尋找原因: <1> 查看調用使用圖表的id是否正確 <2> 不要將echarts.js文件放在<head></head> 里面,容易阻塞后面的html,放在</body>之前。 <3> vue ...

Mon Mar 30 23:39:00 CST 2020 0 9211
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM