美文网首页
一个页面不同位置,渲染多个echarts

一个页面不同位置,渲染多个echarts

作者: 老板下碗面 | 来源:发表于2022-07-08 12:18 被阅读0次
      <el-form-item prop="a" :label="'一楼:'">
        <geoJson />
      </el-form-item>
      <el-form-item prop="a" :label="'二楼:'">
        <geoJson />
      </el-form-item>
    //如有页面需要多次调用,使用document.getElementById不能多次初始化,只会显示一个
    //用this.$refs.myChart 或者currentInstance.ctx.$refs.myChart
  import { getCurrentInstance, onMounted } from '@vue/runtime-core'
setup(){

      onMounted(() => {
        currentInstance = getCurrentInstance()
      })

  const initGeo = (num) => {
        var dom = currentInstance.ctx.$refs.myChart
        const myChart = echarts.init(dom)
    }
}

相关文章

网友评论

      本文标题:一个页面不同位置,渲染多个echarts

      本文链接:https://www.haomeiwen.com/subject/wdombrtx.html