Uncaught (in promise) Error: Component series.map not exists. Load it first
1、错误描述
Uncaught (in promise) Error: Component series.map not exists. Load it first.
at Function.entity.getClass (clazz.js:178)
at ExtendedClass.<anonymous> (Global.js:223)
at Array.forEach (<anonymous>)
at each (util.js:298)
at ExtendedClass.visitComponent (Global.js:212)
at Function.entity.topologicalTravel (component.js:125)
at ExtendedClass.mergeOption (Global.js:194)
at ExtendedClass.initBase (Global.js:663)
at ExtendedClass.resetOption (Global.js:141)
at ExtendedClass.setOption (Global.js:123)
index.vue?a44b:214 Array(102)
2、错误原因
在vue.js中使用echarts地图时,出现了这个错误提示,echarts中的series引入type:'map'
series: [{
name: '数据',
type: 'map',
mapType: 'hunan',
roam: true,
label: {
normal: {
show: true
},
emphasis: {
show: false
}
},
data: mapData
}]
3、解决办法
由于在加载echarts图形相关的文件时,是依次加入的,单独缺少map
const echarts = require('echarts/lib/echarts')
const axios = require('axios')
require('echarts/lib/chart/map')
require('echarts/lib/chart/bar')
require('echarts/lib/chart/line')
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')