網站首頁 編程語言 正文
Echars 報錯: Error in created hook: “Cannot read properties of undefined (reading ‘getAttribute‘)“
作者:Francis-Yang 更新時間: 2022-12-31 編程語言Echars 報錯:Error in created hook: “TypeError: Cannot read properties of undefined (reading ‘getAttribute’)”
問題描述:
今天用echars畫圖過程中(前端用到vue框架),遇到了一個錯誤:
? Error in created hook: “TypeError: Cannot read properties of undefined (reading ‘getAttribute’)”
F12調式界面如圖:
解決方案:
將調用echars的方法從created(){},放到mounted(){}里邊,如圖:
理由:
created(){}: 在模板渲染成html前調用;一般我們用此方法初始化某些值、屬性,初始化完畢再進行渲染
mounted(){}: 在模板渲染成html后調用;即created(){}初始化完畢后,mounted(){}再對渲染出來的html的dom進行操作
echars渲染圖案時,需要容器放圖形(需要對html的dom節點進行操作),所以應放在mounted(){}里邊
原文鏈接:https://blog.csdn.net/weixin_57529171/article/details/124878986
相關推薦
- 2022-08-02 C/C++詳解如何實現文件備份_C 語言
- 2023-07-18 SpringBoot Cache 整合 Redis 緩存框架
- 2023-03-03 一文詳解Go?Http?Server原理_Golang
- 2022-10-26 Google?Kubernetes?Engine?集群實戰詳解_云其它
- 2022-09-22 ansible-playbook 可用參數
- 2023-04-02 C語言中的線程信號控制詳解_C 語言
- 2023-04-06 C++中的多態問題—理解虛函數表及多態實現原理_C 語言
- 2022-06-02 Pandas數據結構之Series的使用_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支