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

      <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)
    }
}
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容