Null pointer problem occurred in Echarts dynamic add and delete chart.

I am using vue+echart, and the chart for echart operation is encapsulated in a component of vue.

when leaving this component, because DOM is replaced, the referenced diagram naturally becomes null:
Cannot read property "getAttribute" of null

the way I think of is to release resources with dispose when leaving the component:

//
echarts.dispose(chartEle);
chartEle.dispose

I hope you will come up with some ideas.

Apr.20,2022

wouldn't it be bigger to repackage something as big as echarts? It is better to give an interface variable directly. Echarts is easy to operate in the global variable. If it is destroyed, it will destroy


thought. There is a problem with your implementation

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e808cb-ae7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e808cb-ae7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?