1. 高德地图申请key并下载SDK文件(amap-wx.130.js)
2. 在所需页面中引入并定义该文件
const amapFile = require('@/common/amap-wx.130.js');
3. 实现搜索功能
searchAddr(){
let key = 'xxxxxxx' // 申请的key
let myAmapFun = new amapFile.AMapWX({key: key})
myAmapFun.getInputtips({
keywords: this.addrKey, // 搜索的关键词
success:(res)=>{
console.log(res.tips) // 根据关键词搜索到的结果
}
})
},