程序员开发实例大全宝库

网站首页 > 编程文章 正文

vue2使用echarts内置地图实现点击事件

zazugpt 2024-09-04 22:10:31 编程文章 28 ℃ 0 评论

1.mounted添加单击事件

mounted() {
  window.menuHandle = this.menuHandle


  const userInfo = window.localStorage.getItem('userInfo')

  if (userInfo) {
    // 1. 创建一个 ECharts 实例,返回 echartsInstance,不能在单个容器上初始化多个 ECharts 实例
    this.myChart = echarts.init(this.$refs.echart_china);
    this.drawmap();

    this.clickGoNext();

  }


},

2.添加单击方法


clickGoNext() {


  // 鼠标事件
  this.myChart.on("click", function (res) {
    console.log("click city:", res.name);

  });
}

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表