Amap.markers(startPoi, endPoi, "", function(res) {
console.log('点数据', res)
var tmpMarkers = res
that.markers = res
})

- 发布:2020-08-04 17:30
- 更新:2020-08-11 19:59
- 阅读:582
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 10.15.6
HBuilderX类型: 正式
HBuilderX版本号: 2.8.3
手机系统: Android
手机系统版本号: Android 7.1.1
手机厂商: 小米
手机机型: 9
页面类型: nvue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
nuve页面中应该会获得用外部数据返回的值
nuve页面中应该会获得用外部数据返回的值
实际结果:
nvue页面中map组件无小广阔
nvue页面中map组件无小广阔
bug描述:
Amap.markers(startPoi, endPoi, "", function(res) {
console.log('点数据', res)
var tmpMarkers = res
that.markers = res
})
其中res返回数据为
···
[{
"iconPath": "/static/map/startPoi.png",
"id": 0,
"longitude": "111.95046",
"latitude": "21.88415",
"width": 23,
"height": 33
}, {
"iconPath": "/static/map/endPoi.png",
"id": 1,
"longitude": "111.94995472235",
"latitude": "21.902531198056",
"width": 23,
"height": 33
}, {
"iconPath": "/static/map/tjd.png",
"id": 0,
"longitude": null,
"latitude": null,
"width": 23,
"height": 33
}]
···
符合markers中所需,但从外部返回数据不生效,如果单独将数据写死可以生效如
Amap.markers(startPoi, endPoi, "", function(res) {
console.log('点数据', res)
var tmpMarkers = res
that.markers = [{
"iconPath": "/static/map/startPoi.png",
"id": 0,
"longitude": "111.95046",
"latitude": "21.88415",
"width": 23,
"height": 33
}, {
"iconPath": "/static/map/endPoi.png",
"id": 1,
"longitude": "111.94995472235",
"latitude": "21.902531198056",
"width": 23,
"height": 33
}, {
"iconPath": "/static/map/tjd.png",
"id": 0,
"longitude": null,
"latitude": null,
"width": 23,
"height": 33
}]
})
也尝试过在创建方法直接用this,任然不生效
2 个回复
a***@163.com (作者) - IT理工男
有人吗?
DCloud_uni-ad_HDX
仅提供了部分代码,无法确定问题
请参考: https://ask.dcloud.net.cn/question/91041