Cannot read property 'echarts' of undefined

简介: Cannot read property 'echarts' of undefined

场景描述:

将echarts 引入到vue项目中,使用了地图map,在开发环境中引入没有问题

import Echarts from "echarts";
// 引入中国地图数据
import "./china.js";

打包上线后发现界面白屏,而且控制台报错

Cannot read property 'echarts' of undefined

问题解决

由于参考了网上的文章,将china.js 单独下载使用,导致引入问题

其实,安装完echarts 里边就带有中国地图了,正确的引入方式应该是:

import Echarts from "echarts";
// 引入中国地图数据
import "echarts/map/js/china.js";
相关文章
|
容器
Echarts报错 Cant read property getWidth of null的解决方案
Echarts报错 Cant read property getWidth of null的解决方案
186 0
|
4月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
100 0
|
7月前
|
JavaScript
Vue报错 Invalid default value for prop “list“: Props with type Object/Array must use a factory
Vue报错 Invalid default value for prop “list“: Props with type Object/Array must use a factory
358 0
|
JavaScript API
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
【Vue】Cannot set reactive property on undefined,null,or primitive value:undefined
389 0
|
7月前
|
机器学习/深度学习
TypeError: Cannot read property ‘name‘ of undefined at Qe.onShow
TypeError: Cannot read property ‘name‘ of undefined at Qe.onShow
53 0
|
7月前
|
JavaScript 安全
Cannot read property ‘querySelectorAll‘ of undefined问题解决
Cannot read property ‘querySelectorAll‘ of undefined问题解决
161 2
解决 TypeError: Cannot read property ‘tapPromise‘ of undefined
解决 TypeError: Cannot read property ‘tapPromise‘ of undefined
468 0
|
7月前
|
JavaScript
【报错】Cannot read property ‘parseComponent‘ of undefined
【报错】Cannot read property ‘parseComponent‘ of undefined
636 2
|
7月前
|
JavaScript 前端开发
Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”
Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”
388 1
|
7月前
|
JavaScript
【报错】:Cannot read properties of undefined (reading ‘prototype‘)
【报错】:Cannot read properties of undefined (reading ‘prototype‘)
404 0