巨坑!!! 一定要在main里面,全局注册组件的下面加上这一句
app.config.globalProperties.$echarts = echarts
不然调试可能是没任何问题,但是当你bulid完布上线之后控制台就会报这样奇奇怪怪的错误 你还根本不知道是哪产生的错误
Uncaught (in promise) TypeError: an is not a function at index-04720eab.js:273:7616 at index-04720eab.js:325:16829
以下是可以使用的正常配置
main.js中全局注册组件
// 引入vue-echarts
import ECharts from 'vue-echarts'
import * as echarts from "echarts"
// 全局注册组件(也可以使用局部注册)
app.component('v-chart', ECharts)
app.config.globalProperties.$echarts = echarts