1***@qq.com
1***@qq.com
  • 发布:2020-04-10 11:12
  • 更新:2021-07-17 14:30
  • 阅读:746

【报Bug】Maps组件的markers属性,iconPath路径有问题,自定义基座可以正常显示图片,云打包之后图片路径失效

分类:uni-app
map

详细问题描述

Maps组件的markers属性,iconPath路径有问题,自定义基座可以正常显示图片,云打包之后图片路径失效,只会显示maps默认的蓝色气泡markers

重现步骤

[步骤]

[结果]

[期望]

IDE运行环境说明

[HBuilder 或 HBuilderX。如果你用其他工具开发uni-app,也需要在此说明] HBuilderX

[IDE版本号]

[windows版本号] Windows7

[mac版本号]

uni-app运行环境说明

[运行端是h5或app或某个小程序?] App

[运行端版本号]

HBuilderX创建

[编译模式说明:]V3

App运行环境说明

安卓版本:安卓10

[iOS版本号]

手机型号:mate30pro、Nova5、红米

安卓模拟器:逍遥

附件

[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成zip包上传]

安装包、项目文件、截图均在附件zip之中

<template>
<view class="page">
<navbar :title="title"></navbar>
<view class="map">
<map :latitude="latitude" :longitude="longitude" :markers="markers" :polyline="polyline" :scale="scale"></map>
</view>
</view>
</template>

<script>
import navbar from '../../components/navbar.vue'
export default {
components:{
navbar
},
data() {
return {
title:'',
markers:[],
polyline:[],
latitude:'',
longitude:'',
scale:14,
id:'',
type:'',
st:'',
et:'',
interval:''
};
},
methods:{
drawLine(t){
if(t==1){
this.getProjectLines()
}else{
this.getLines()
}
},
getProjectLines(){
let data = {
project_id:this.id,
startStation:this.st,
endStation:this.et,
latitude:this.latitude,
longitude:this.longitude
}
this.$api.resultMap(data,res=>{
this.markers = res.data.markers
this.polyline = res.data.polyline
})
},
getLines(){
let data = {
line_id:this.id,
line_type:this.type,
latitude:this.latitude,
longitude:this.longitude
}
this.$api.lineMap(data,res=>{
this.markers = res.data.markers
this.polyline = res.data.polyline
})
}
},
onLoad(options) {
if(options.t==1){
this.st = options.st
this.et = options.et
}else{
this.type = options.type
}
this.latitude = this.$store.state.gps.lat
this.longitude = this.$store.state.gps.lng
this.title = options.name
this.id = options.id
this.drawLine(options.t)
this.interval = setInterval(()=>{
this.drawLine(options.t)
},10000)
},
onShow() {

    },  
    onUnload() {  
        clearInterval(this.interval)  
    }  
}  

</script>

<style lang="scss" scoped>
.page{
width: 100%;
height: 100%;
padding-top: 150upx;
box-sizing: border-box;
position: fixed;
left: 0px;
top: 0px;
z-index: 1;
.map{
width: 100%;
height: 100%;
map{
width: 100%;
height: 100%;
}
}
}
</style>

联系方式

QQ:1261639306

2020-04-10 11:12 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者) - 90后菜鸡

不让我上传代码和安装包,我也很无奈

笑望哥

笑望哥

h***@126.com

h***@126.com

请问楼主解决了吗?

笑望哥

笑望哥

我的正常。nvue

{
//我的位置
id: 10,
latitude: this.userLocation.latitude,
longitude: this.userLocation.longitude,
iconPath: '/static/location.png',
width: 40,
height: 40
}

该问题目前已经被锁定, 无法添加新回复