vue3中使用高德地图

作者: 川某人 | 来源:发表于2020-07-16 02:03 被阅读0次

vue3中不需使用vue.config.js进行配置
也并不需要使用import AMap from 'AMap'导入

index.html页面中引入API

index.html文件中引入api

给组件绑定id

<template>
      <div id="container"></div>
 </template>

初始化函数

methods: {
    init() {
      var map = new AMap.Map("container");
      window.map = map;
    }
}

调用初始化函数

  mounted() {
    this.init();
  },

显示地图

高德地图

相关文章

网友评论

    本文标题:vue3中使用高德地图

    本文链接:https://www.haomeiwen.com/subject/ymhshktx.html