在vue里面使用echarts提示template or render function not defined

发布于 2022-09-11 22:08:47 字数 1354 浏览 12 评论 0

在vue2.6.10的项目里面使用echarts4.2.1版本提示Failed to mount component: template or render function not defined
请问如何解决呢?
我是以

import echarts from 'echarts/lib/echarts'
import 'echarts/lib/chart/pie'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/toolbox'
import 'echarts/lib/component/legend'
import 'echarts/lib/component/title'

mounted () {
    this.loadBarChart()
  },
  methods: {
    /**
     * 加载数据
     */
    loadBarChart () {
      this.pieSystem = echarts.init(document.getElementById('pieSystemSuccess_main'), 'walden')
      this.pieSystem.setOption({
        title: {
          text: '系统成功率',
          subtext: '纯属虚构'
        },
        tooltip: {
          trigger: 'item',
          formatter: '{b}: {c} ({d}%)'
        },
        legend: {
          orient: 'vertical',
          x: 'left',
          top: '50',
          data: this.systemList.forEach((item) => { return item.reason })
        },
        series: {
          name: '数据详情',
          type: 'pie',
          radius: ['0', '55%'],
          data: this.$releaseEchartsData(this.systemList, 'system', 'number')
        }
      })
      const data = {
        nameStr: 'pieSystemProp',
        data: this.pieSystem
      }
      this.$emit('releaseEchartsComponents', data)
    }
  }

这种形式来进行使用的,请问如何解决这个警告呢?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紅太極 2022-09-18 22:08:47

你既没有写template,也没有在js里面写render,怎么可能不报错

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文