The latest version of ecarts dependency, version 5. X, is installed through NPM. However, most of the online tutorials are introduced in the way of 4. X, while the introduction method of version 5. X has changed, resulting in an error;
Solution
The method of introducing main.js into ecarts is introduced from 4. X:
import echarts from 'echarts'
Change to 5. X import mode:
import * as echarts from 'echarts'
Read More:
- Error in mounted hook: “TypeError: Cannot read property ‘init‘ of undefined“
- Vue uses this. $refs. Subcomponent Ref. method to report an error: cannot read property ‘resetfields’ of undefined problem
- Vue introduces ecarts, init initializes and reports an error
- Vue error in render: “typeerror: cannot read property ‘name’ of undefined”
- [Solved] Vue Error: TypeError: Cannot read property ‘end‘ of undefined
- Using pop-up window and I18N, error in render: “typeerror: cannot read property” appears_ T ‘of undefined’ solution
- Vue error resolution: TypeError: Cannot read property’_t’ of undefined”
- Vue error resolution: typeerror: cannot read property ‘_ t’ of undefined”
- Error in created hook: “typeerror: cannot read property ‘cm’ of undefined”
- [_ Note] Vue.js reported an error: Cannot read property’validate’ of undefined”
- TypeError: Cannot read property ‘username‘ of undefined
- Cannot read property ‘substring’ of undefined in Vue
- TypeError: Cannot read property thisCompilation of undefined
- [Solved] Syntax Error: TypeError: Cannot read property ‘parseComponent‘ of undefined
- Vue: cannot read property ‘substring’ of undefined“
- Datatable plug-in error: uncaught typeerror: cannot read property ‘style’ of undefined
- Use less.js to verify and report an error in the Vue file of vscode
- Cannot read property ‘this compilation’ of undefined appears in copy webpack plugin
- [Solved] Import Echars5.0 Error: “export ‘default‘ (imported as ‘echarts‘) was not found in ‘echarts‘
- [Vue warn]: Error in nextTick: “TypeError: Cannot read property ‘map‘ of null“