vue高德地图 弹窗自定义点击事件

html yekong 0评论
markerClick(e) {
      console.log(e)
      var MyComponent = Vue.extend({
        template: `<div class="detailpop">
          <div class="detailpoptitle">
            <h3>{{equipmentAlias}}</h3>
            <div class="gj" @click="appointTrackQuery(getExtData)">轨迹</div>
          </div>
          <p>设备类型:<span>{{getTitle}}</span></p>
          <p>设备状态:<span>正常</span></p>
          </div>`,
        data: function () {
          return {
            equipmentAlias: e.target.getExtData().equipmentAlias,
            getTitle: e.target.getTitle(),
            getExtData: e.target.getExtData(),
          }
        },
        methods: {
          appointTrackQuery: function () {
            console.log('appointTrackQuery')
          }
        }
      });
      var component = new MyComponent().$mount();
      let infoWindow = new AMap.InfoWindow({
        anchor: 'top-left',
        offset: new AMap.Pixel(-20, -35),
        content: component.$el,
      });
      infoWindow.open(this.map, [e.lnglat.lng, e.lnglat.lat])
    },

使用此方法可能会报下面的错误,按照提示修改重新运行就可以了。
You are using the runtime-only build of Vue

喜欢