提交 924aec31 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

fix(chooseLocation): H5 高德地图地址名称丢失 (question/171013)

上级 8def9994
......@@ -196,7 +196,7 @@ export default {
pushData (array) {
array.forEach(item => {
this.list.push({
name: item.title,
name: item.title || item.name,
address: item.address,
distance: item._distance || item.distance,
latitude: item.location.lat,
......@@ -269,22 +269,24 @@ export default {
const self = this
window.AMap.plugin('AMap.PlaceSearch', function () {
const placeSearch = new window.AMap.PlaceSearch({
city: '全国',
pageSize: 10,
pageIndex: self.pageIndex
})
const keyword = self.searching ? self.keyword : ''
const radius = self.searching ? 50000 : 5000
placeSearch.searchNearBy(keyword, [self.longitude, self.latitude], radius, function (status, result) {
if (status === 'error') {
console.error(result)
} else if (status === 'no_data') {
self.hasNextPage = false
} else {
self.pushData(result.poiList.pois)
}
})
if (self.longitude && self.latitude) {
const placeSearch = new window.AMap.PlaceSearch({
city: '全国',
pageSize: 10,
pageIndex: self.pageIndex
})
const keyword = self.searching ? self.keyword : ''
const radius = self.searching ? 50000 : 5000
placeSearch.searchNearBy(keyword, [self.longitude, self.latitude], radius, 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
})
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册