amap结合vue使用弹窗时怎么结合vue框架

<template>

<div v-show="infoWinShow" class="infoWindow" ref="infoWindow"> </div>
</template>
 
 let html=this.$refs.infoWindow
      this.infoWindow=new AMap.InfoWindow({
        map:this.mapx,
        content:html,
        position:[event.longitude,event.latitude],
        zoom:16
      });

先 在vue处创建dom节点

在需要使用的地方用$refs获取dom然后插入dom。

这样就可以继续使用vue框架而不是笨拙的在全局创建方法和使用原生点击事件了。


posted @ 2022-03-03 16:36  前端路远且长  阅读(125)  评论(0)    收藏  举报