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>
目录
相关文章
|
定位技术 Apache
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
Echarts——Invalid geoJson format Cannot read property 'length' of undefined
259 0
|
JavaScript
引入echarts时报错 “TypeError: Cannot read properties of undefined (reading ‘init‘)“的解决方案
引入echarts时报错 “TypeError: Cannot read properties of undefined (reading ‘init‘)“的解决方案
1351 0
引入echarts时报错 “TypeError: Cannot read properties of undefined (reading ‘init‘)“的解决方案
|
JavaScript
Vue整合Echarts报错:“TypeError: Cannot read properties of undefined (reading ‘init‘)“
Vue整合Echarts报错:“TypeError: Cannot read properties of undefined (reading ‘init‘)“
2521 0
Vue整合Echarts报错:“TypeError: Cannot read properties of undefined (reading ‘init‘)“
|
JSON 定位技术 开发工具
解决echarts地图geoJson报错问题(“echarts.min.js:45 Uncaught Error: Invalid geoJson format Cannot read prope”)
解决报错: 1.Invalid geoJson format Cannot read property ‘length’ of undefined 2 echarts.min.js:45 Uncaught Error: Invalid geoJson format Cannot read prope
1577 0
解决echarts地图geoJson报错问题(“echarts.min.js:45 Uncaught Error: Invalid geoJson format Cannot read prope”)
|
小程序 JavaScript
微信小程序使用echarts图表(ec-canvas)
这篇文章介绍了在微信小程序中使用`ec-canvas`集成echarts图表的方法,包括解决加载时报错的问题、配置图表组件、以及在小程序页面中引入和使用这些图表组件的步骤。
2105 1
微信小程序使用echarts图表(ec-canvas)
|
小程序 前端开发 JavaScript
微信小程序图表制作利器:ECharts组件的使用与技巧
微信小程序图表制作利器:ECharts组件的使用与技巧
1374 1
|
前端开发 数据可视化 JavaScript
Echarts如何实现多图表缩放和自适应?附源码
Echarts如何实现多图表缩放和自适应?附源码
Echarts如何实现多图表缩放和自适应?附源码
|
Web App开发 数据可视化 前端开发
Echart的使用初体验,Echarts的基本使用及语法格式,简单图表绘制和使用及图例添加【学习笔记】
本文介绍了ECharts的基本使用和语法格式,包括如何引入ECharts、创建容器、初始化echarts实例对象、配置option参数和一些基础图表的绘制方法。文章还提供了简单图表绘制和使用图例添加的示例代码,以及对ECharts特性和优势的概述。
Echart的使用初体验,Echarts的基本使用及语法格式,简单图表绘制和使用及图例添加【学习笔记】
|
JavaScript
vue中使用echarts绘制双Y轴图表时,刻度没有对齐的两种解决方法
vue中使用echarts绘制双Y轴图表时,刻度没有对齐的两种解决方法
3808 0
Echarts——如何默认选中图表并显示tooltip
Echarts——如何默认选中图表并显示tooltip
706 1