我是用的是echarts是4.7.0版本,而vue-element-admin 脚手架自带的是4.2.1的,
建议升级版本。

<template>
  <div class="dashboard-container">
    去去去去
    <div ref="myChart" style="width: 100%; height: 400px;" />
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
// import adminDashboard from './admin'
// import editorDashboard from './editor'
import { basicline } from '@/api/chat'
const echarts = require('echarts/lib/echarts')
require('echarts/lib/chart/line')
require('echarts/lib/chart/line')
// 以下的组件按需引入
require('echarts/lib/component/tooltip')
require('echarts/lib/component/title')
require('echarts/lib/component/legend')
const option = ''
export default {
  name: 'Dashboard',
  components: { },
  data() {
    return {
      currentRole: 'editorDashboard',
      chartList: '',
      chart: '',
      option: {}
    }
  },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  mounted() {

  },
  created() {
    basicline({}).then((res) => {
      console.log(res.data)
      this.initChart(obj)
    })
  },
  methods: {
    initChart(option) {
      this.chart = echarts.init(this.$refs.myChart, 'basicline')
      this.chart.setOption(option)
    }
  }
}
</script>

Logo

前往低代码交流专区

更多推荐