详细问题描述
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