1078891936@qq.com
1078891936@qq.com
  • 发布:3 天前
  • 更新:3 天前
  • 阅读:25

【报Bug】mapContext.translateMarker 轨迹显示 浏览器有轨迹 但是安卓手机无法显示轨迹

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: win10

HBuilderX类型: 正式

HBuilderX版本号: 3.1.18

手机系统: Android

手机系统版本号: Android 11

手机厂商: 华为

手机机型: ART-AL00x

页面类型: nvue

nvue编译模式: 纯nvue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:

carline(linedata) {
linedata = [{
latitude: 34.032236,
longitude: 108.720464
},
{
latitude: 34.042236,
longitude: 108.710688
},
{
latitude: 34.052236,
longitude: 108.720688
},
{
latitude: 34.072236,
longitude: 108.720688
}
]
let _this = this
clearInterval(_this.timer);
let cargps = []
linedata.forEach(function(item, index) {
cargps.push({
id: index,
latitude: item.latitude,
longitude: item.longitude,
iconPath: '../../static/iconpj/carbule.png',
width: 20,
height: 20,
})
})
var i = 0;
_this.markers = [cargps[i]]
var mapContext = uni.createMapContext("myMap", this);
let translateMarkerConfig = {
markerId: 0,
destination: {
latitude: cargps[i].latitude,
longitude: cargps[i].longitude,
},
duration: 1000,
animationEnd: function() {
console.log('1轨迹回放完成')
// 轨迹回放完成
},
fail(e) {
// 轨迹回放失败
console.log('轨迹回放失败' + e)
},
}
mapContext.translateMarker(translateMarkerConfig)
console.log(cargps[i])

            _this.timer = setInterval(() => {  
                console.log(cargps[i].latitude)  
                let timefink = {  
                    markerId: 0,  
                    destination: {  
                        latitude: cargps[i + 1].latitude,  
                        longitude: cargps[i + 1].longitude,  
                    },  
                    duration: 1000,  
                    animationEnd: function() {  
                        console.log('2轨迹回放完成')  
                        // 轨迹回放完成  
                    },  
                    fail(e) {  
                        // 轨迹回放失败  
                        console.log('轨迹回放失败' + e)  
                    },  
                }  
                mapContext.translateMarker(timefink)  
                i++  
                if (i + 1 == cargps.length) {  
                    i = 0  
                    clearInterval(_this.timer);  
                }  
            }, 1000);  

        },

操作步骤:

carline(linedata) {
linedata = [{
latitude: 34.032236,
longitude: 108.720464
},
{
latitude: 34.042236,
longitude: 108.710688
},
{
latitude: 34.052236,
longitude: 108.720688
},
{
latitude: 34.072236,
longitude: 108.720688
}
]
let _this = this
clearInterval(_this.timer);
let cargps = []
linedata.forEach(function(item, index) {
cargps.push({
id: index,
latitude: item.latitude,
longitude: item.longitude,
iconPath: '../../static/iconpj/carbule.png',
width: 20,
height: 20,
})
})
var i = 0;
_this.markers = [cargps[i]]
var mapContext = uni.createMapContext("myMap", this);
let translateMarkerConfig = {
markerId: 0,
destination: {
latitude: cargps[i].latitude,
longitude: cargps[i].longitude,
},
duration: 1000,
animationEnd: function() {
console.log('1轨迹回放完成')
// 轨迹回放完成
},
fail(e) {
// 轨迹回放失败
console.log('轨迹回放失败' + e)
},
}
mapContext.translateMarker(translateMarkerConfig)
console.log(cargps[i])

            _this.timer = setInterval(() => {  
                console.log(cargps[i].latitude)  
                let timefink = {  
                    markerId: 0,  
                    destination: {  
                        latitude: cargps[i + 1].latitude,  
                        longitude: cargps[i + 1].longitude,  
                    },  
                    duration: 1000,  
                    animationEnd: function() {  
                        console.log('2轨迹回放完成')  
                        // 轨迹回放完成  
                    },  
                    fail(e) {  
                        // 轨迹回放失败  
                        console.log('轨迹回放失败' + e)  
                    },  
                }  
                mapContext.translateMarker(timefink)  
                i++  
                if (i + 1 == cargps.length) {  
                    i = 0  
                    clearInterval(_this.timer);  
                }  
            }, 1000);  

        },

预期结果:

carline(linedata) {
linedata = [{
latitude: 34.032236,
longitude: 108.720464
},
{
latitude: 34.042236,
longitude: 108.710688
},
{
latitude: 34.052236,
longitude: 108.720688
},
{
latitude: 34.072236,
longitude: 108.720688
}
]
let _this = this
clearInterval(_this.timer);
let cargps = []
linedata.forEach(function(item, index) {
cargps.push({
id: index,
latitude: item.latitude,
longitude: item.longitude,
iconPath: '../../static/iconpj/carbule.png',
width: 20,
height: 20,
})
})
var i = 0;
_this.markers = [cargps[i]]
var mapContext = uni.createMapContext("myMap", this);
let translateMarkerConfig = {
markerId: 0,
destination: {
latitude: cargps[i].latitude,
longitude: cargps[i].longitude,
},
duration: 1000,
animationEnd: function() {
console.log('1轨迹回放完成')
// 轨迹回放完成
},
fail(e) {
// 轨迹回放失败
console.log('轨迹回放失败' + e)
},
}
mapContext.translateMarker(translateMarkerConfig)
console.log(cargps[i])

            _this.timer = setInterval(() => {  
                console.log(cargps[i].latitude)  
                let timefink = {  
                    markerId: 0,  
                    destination: {  
                        latitude: cargps[i + 1].latitude,  
                        longitude: cargps[i + 1].longitude,  
                    },  
                    duration: 1000,  
                    animationEnd: function() {  
                        console.log('2轨迹回放完成')  
                        // 轨迹回放完成  
                    },  
                    fail(e) {  
                        // 轨迹回放失败  
                        console.log('轨迹回放失败' + e)  
                    },  
                }  
                mapContext.translateMarker(timefink)  
                i++  
                if (i + 1 == cargps.length) {  
                    i = 0  
                    clearInterval(_this.timer);  
                }  
            }, 1000);  

        },

实际结果:

app端无轨迹显示

bug描述:

carline(linedata) {
linedata = [{
latitude: 34.032236,
longitude: 108.720464
},
{
latitude: 34.042236,
longitude: 108.710688
},
{
latitude: 34.052236,
longitude: 108.720688
},
{
latitude: 34.072236,
longitude: 108.720688
}
]
let _this = this
clearInterval(_this.timer);
let cargps = []
linedata.forEach(function(item, index) {
cargps.push({
id: index,
latitude: item.latitude,
longitude: item.longitude,
iconPath: '../../static/iconpj/carbule.png',
width: 20,
height: 20,
})
})
var i = 0;
_this.markers = [cargps[i]]
var mapContext = uni.createMapContext("myMap", this);
let translateMarkerConfig = {
markerId: 0,
destination: {
latitude: cargps[i].latitude,
longitude: cargps[i].longitude,
},
duration: 1000,
animationEnd: function() {
console.log('1轨迹回放完成')
// 轨迹回放完成
},
fail(e) {
// 轨迹回放失败
console.log('轨迹回放失败' + e)
},
}
mapContext.translateMarker(translateMarkerConfig)
console.log(cargps[i])

            _this.timer = setInterval(() => {  
                console.log(cargps[i].latitude)  
                let timefink = {  
                    markerId: 0,  
                    destination: {  
                        latitude: cargps[i + 1].latitude,  
                        longitude: cargps[i + 1].longitude,  
                    },  
                    duration: 1000,  
                    animationEnd: function() {  
                        console.log('2轨迹回放完成')  
                        // 轨迹回放完成  
                    },  
                    fail(e) {  
                        // 轨迹回放失败  
                        console.log('轨迹回放失败' + e)  
                    },  
                }  
                mapContext.translateMarker(timefink)  
                i++  
                if (i + 1 == cargps.length) {  
                    i = 0  
                    clearInterval(_this.timer);  
                }  
            }, 1000);  

        },  

app 打印台 都进不去轨迹成功失败的回调 其余所有cosoler 都能打出来

3 天前 负责人:无 分享
已邀请:
木杉丶

木杉丶 - 你喜或悲,他也都在那里

nvue页面我记得app端好像是要放到计算属性computed里面然后重新赋值在放到map那里才会显示的。

1078891936@qq.com

1078891936@qq.com (作者)

已解决 不要用vue 用nvue

要回复问题请先登录注册