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";
            </div>
目录
相关文章
|
容器
Echarts报错 Cant read property getWidth of null的解决方案
Echarts报错 Cant read property getWidth of null的解决方案
155 0
|
5月前
|
小程序 前端开发 API
【微信小程序】TypeError: Cannot read property ‘get‘ of undefined & Error: MiniProgramError
【微信小程序】TypeError: Cannot read property ‘get‘ of undefined & Error: MiniProgramError
|
2月前
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
40 0
|
5月前
|
机器学习/深度学习
TypeError: Cannot read property ‘name‘ of undefined at Qe.onShow
TypeError: Cannot read property ‘name‘ of undefined at Qe.onShow
43 0
|
5月前
|
iOS开发 MacOS
TypeError: Cannot read property ‘shop‘ of undefined
TypeError: Cannot read property ‘shop‘ of undefined
34 0
|
12月前
|
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
211 0
|
5月前
|
JavaScript 安全
Cannot read property ‘querySelectorAll‘ of undefined问题解决
Cannot read property ‘querySelectorAll‘ of undefined问题解决
114 2
|
5月前
|
JavaScript
【报错】Cannot read property ‘parseComponent‘ of undefined
【报错】Cannot read property ‘parseComponent‘ of undefined
569 2
解决 TypeError: Cannot read property ‘tapPromise‘ of undefined
解决 TypeError: Cannot read property ‘tapPromise‘ of undefined
388 0
|
5月前
|
JavaScript 前端开发
Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”
Vue报错“ Uncaught TypeError: Cannot read property ‘use‘ of undefined”
309 1