0%
引入
1
| import amap from '@/lib/amap/amap-wx.js';
|
初始化
1 2 3
| myAmapFun = new amap.AMapWX({ key: this.key });
|
获取当前定位信息
1 2 3 4 5 6 7 8 9 10 11 12 13
| this.myAmapFun.getRegeo({ citylimit: true, success: res => { console.log(res[0].regeocodeData.addressComponent); console.log(res[0].regeocodeData.pois); }, fail: err => { uni.showToast({ title: '获取当前定位失败,请手动输入查询', icon: 'none' }); } });
|
通过输入词,查询周边地址
1 2 3 4 5 6 7 8 9 10
| myAmapFun.getInputtips({ keywords: '', city: this.addressData.cityName, extensions: 'all', success: res => { if (res && res.tips) { console.log(res); } } });
|