1***@qq.com
1***@qq.com
  • 发布:2020-04-11 10:03
  • 更新:2020-04-11 10:03
  • 阅读:710

【报Bug】Map组件的markers动态更新的时候,会导致polyline画的路线消失

分类:uni-app

详细问题描述

我用定时request的方法更新map组件的markers,每次更新的时候都会导致地图上的标记点和polyline全部重绘,有时polyline在重绘后会消失,不知道是不是重绘失败了

重现步骤

[期望] 期望官方能解决重绘之后polyline消失的问题

IDE运行环境说明

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

HBuilderX 2.6.11

[windows版本号]

windows 7

uni-app运行环境说明

安卓真机调试自定义基座

[运行端版本号]

使用HBuilderX创建的项目

[编译模式说明]

编译模式V3

App运行环境说明

[Android版本号]

安卓10

[手机型号]

Mate30pro,Nova5,红米

[模拟器型号]

逍遥模拟器

附件

[IDE问题请提供HBuilderX运行日志。菜单帮助-查看运行日志,点右键打开文件所在目录,将log文件压缩成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.polyline = res.data.polyline
this.markers = res.data.markers
})
},
getProjectLinesMarker(){
let data = {
project_id:this.id,
startStation:this.st,
endStation:this.et,
latitude:this.latitude,
longitude:this.longitude
}
this.$api.resultMap(data,res=>{
console.log(res)
this.markers = res.data.markers
})
},
getLines(){
let data = {
line_id:this.id,
line_type:this.type,
latitude:this.latitude,
longitude:this.longitude
}
this.$api.lineMap(data,res=>{
this.polyline = res.data.polyline
this.markers = res.data.markers
})
},
getLinesMarker(){
let data = {
line_id:this.id,
line_type:this.type,
latitude:this.latitude,
longitude:this.longitude
}
this.$api.lineMap(data,res=>{
console.log(res)
this.markers = res.data.markers
})
},
getMarkers(t){
if(t==1){
this.getProjectLinesMarker()
}else{
this.getLinesMarker()
}
}
},
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)
this.getMarkers(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>

http://anpingbus.com:85/apk/apbus-an.apk 安卓安装包下载地址

联系方式

[QQ] 1261639306

2020-04-11 10:03 负责人:无 分享
已邀请:

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