HBuilder版本号: 2.9.3.20201014
出错平台: android App
问题描述:在小程序中可流畅运行,在app端marker并不会产生移动
模拟器: 雷神四
demo地址: https://github.com/asagcs/ceshi
代码:
<template>
<view class="wrapper">
<map class="mymap" id="trajectoryMapApp"
:latitude="latitude" :longitude="longitude"
:markers="markers"
:include-points="markers"
>
</map>
<view @tap="tapsdf">
<text>点我移动</text>
</view>
</view>
</template>
<script>
import mqtt from "../../libs/mqtt.min.js";
import { mapMutations } from "vuex";
import ponits from '../../data/index.json';
export default {
data() {
return {
markers: [{
id: 0,
latitude: "30.33943637197179",
longitude: '116.59881658661818',
iconPath: "/static/logo.png",
callout: {
content: "333", // 车牌信息
display: "BYCLICK",
fontWeight: "bold",
color: "#5A7BEE", //文本颜色
fontSize: "12px",
bgColor: "#ffffff", //背景色
padding: 5, //文本边缘留白
textAlign: "center",
},
width: 32,
height: 32
}],
index: 1,
latitude: '30.33943637197179',
longitude: '116.59881658661818'
}
},
created() {
},
methods: {
tapsdf: function() {
console.log("我要移动了")
let index = this.index;
var mapContext = uni.createMapContext("trajectoryMapApp", this);
let translateMarkerConfig = {
markerId: 0,
destination: {
longitude: ponits[index].longitude, // 车辆即将移动到的下一个点的经度
latitude: ponits[index].latitude, // 车辆即将移动到的下一个点的纬度
},
duration: 100,
autoRotate: true,
success: (e) => {
console.log(e)
},
fail: (err) => {
console.log(err)
}
};
this.index +=1;
console.log(translateMarkerConfig)
mapContext.translateMarker(translateMarkerConfig);
}
},
};
</script>
<style>
.wrapper {
display: flex;
flex: 1;
}
.mymap {
display: flex;
flex: 1;
height: 60vh;
width: 100%;
}
</style>
j***@163.com (作者)
谢谢!
2020-10-26 13:47