
十点睡
- 发布:2020-09-27 14:23
- 更新:2020-09-27 17:05
- 阅读:814
使用nvue模版 map上 markers点 动态渲染 ios 无法渲染
分类:uni-app

十点睡 (作者)
regionchangeMap() {
const that = this;
that.nav_map.getCenterLocation({
success(e) {
that.latitude = e.latitude
that.longitude = e.longitude
that.getMapList()
},
error(e) {
console.log(e)
}
})
},
// 获取定位
getDw() {
let _this = this
uni.getLocation({
type: 'gcj02',
success: (res) => {
// 初始化地图中心点
_this.latitude = res.latitude
_this.longitude = res.longitude
// 初始化坐标
_this.latitudeMove = res.latitude
_this.longitudeMove = res.longitude
// _this.isMapShow = false
_this.getMapList()
},
fail: (err) => {
console.log(err)
}
});
},
async getMapList() {
try {
this.maps = false
let tudeData = {}
tudeData = this.qqMapTransBMap(this.longitude, this.latitude)
let data = {
name: this.name + "",
maxdistance: 1 + "",
latitude: tudeData.lat + "",
longtitude: tudeData.lng + "",
type: this.active
// pageSize: 100,
}
// console.log(JSON.stringify(data))
// 获取地点 渲染初始位置 地图中心
await getMap(data).then(res => {
if (res.data.code == 200) {
let dataArr = res.data.result
let imgUrl = ''
let arrList = []
this.markers = []
for (let i = 0; i < dataArr.length; i++) {
if (dataArr[i].ploType == 1) {
imgUrl = './../../static/map/nearby_map_chongdianzhuang_position_ic_idle.png'
} else {
imgUrl = './../../static/map/nearby_map_tingchechagn_position_ic_idle.png'
}
let longData = this.bd_decrypt(dataArr[i].longitude, dataArr[i].latitude)
dataArr[i].markerId = dataArr[i].id
dataArr[i].latitude = longData.lat
dataArr[i].longitude = longData.lng
dataArr[i].iconPath = imgUrl
}
if (dataArr[0].ploType == 1) {
dataArr[0].iconPath = './../../static/map/nearby_map_chongdianzhuang_position_ic_idle2.png'
} else {
dataArr[0].iconPath = './../../static/map/location.png'
}
this.info = dataArr[0]
this.markers = dataArr
} else {
uni.showToast({
title: res.data.message,
duration: 2000,
icon: 'none'
});
}
})
} catch (err) {
console.log(err)
}
},
十点睡 (作者)
上传了
2020-09-27 16:17