Skip to content

Commit

Permalink
fix(chooseLocation): H5 高德地图地址名称丢失 (question/171013)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyuWang committed Jun 1, 2023
1 parent 8def999 commit 924aec3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/uni-h5/dist/index.umd.min.js

Large diffs are not rendered by default.

36 changes: 19 additions & 17 deletions src/platforms/h5/components/system-routes/choose-location/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
})
}
Expand Down

0 comments on commit 924aec3

Please sign in to comment.