mounted() {
  // AMapUI.loadUI(...)
    this.init ();
  },
  methods: {
    init () {
     let script = document.getElementById('gaodeMapScript');
      // if(this.map) return;
      // this.isBodyLoading = true;
      if(!script){
        script = document.createElement('script');
        script.id = 'gaodeMapScript';
        script.src = 'https://webapi.amap.com/maps?v=1.4.15&key=5646';
        document.body.append(script);
        script.addEventListener('load',e =>{
          setTimeout(this.marker,500);
        })
      }else{
        this.marker();
      }
    }
    }
Logo

前往低代码交流专区

更多推荐