提交 3cf0a535 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(h5 chooseLocation): 支持高德地图

上级 2e35adba
......@@ -198,7 +198,7 @@ export default {
this.list.push({
name: item.title,
address: item.address,
distance: item._distance,
distance: item._distance || item.distance,
latitude: item.location.lat,
longitude: item.location.lng
})
......@@ -265,6 +265,39 @@ export default {
}, () => {
this.loading = false
})
} else if (mapInfo.type === MapType.AMAP) {
const self = this
window.AMap.plugin('AMap.PlaceSearch', function () {
var autoOptions = {
city: '全国',
pageSize: 10,
pageIndex: self.pageIndex
}
var placeSearch = new window.AMap.PlaceSearch(autoOptions)
if (self.searching) {
placeSearch.searchNearBy(self.keyword, [self.longitude, self.latitude], 50000, function (status, result) {
if (status === 'error') {
console.error(result)
} else if (status === 'no_data') {
self.hasNextPage = false
} else {
self.pushData(result.poiList.pois)
}
})
} else {
placeSearch.searchNearBy('', [self.longitude, self.latitude], 5000, function (status, result) {
if (status === 'error') {
console.error(result)
} else if (status === 'no_data') {
self.hasNextPage = false
} else {
self.pushData(result.poiList.pois)
}
})
}
self.loading = false
})
}
},
loadMore () {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册