【问题标题】:Vue one file, echarts error xAxis "0" not foundvue一文件,echarts报错xAxis "0" not found
【发布时间】:2021-05-08 13:22:43
【问题描述】:

我是 Vue 和 echarts 的新手。

我遵循了这个教程:https://www.freecodecamp.org/news/how-to-add-charts-and-graphs-to-a-vue-js-application-29f943a45d09/

直到我可以运行我的“npm run serve”命令。 我打开了我的本地主机,但图表不在那里。 我在控制台中收到错误消息:错误:未找到 xAxis“0” 我错过了什么吗?我的代码看起来和教程一样。

【问题讨论】:

  • 文件:@/plugins/echarts.js,将import 'echarts/lib/chart/bar'; 更改为import * as echarts from 'echarts';。如果您使用的是 eslint,请在其前面添加 // eslint-disable-next-line

标签: vue.js echarts


【解决方案1】:

你用的是 echarts v5.x 吗?如果是这样,那么您还需要导入GridComponent。参考github上的这个issue

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-13
    • 2017-06-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多