j***@163.com
j***@163.com
  • 发布:2020-10-26 11:42
  • 更新:2020-11-02 12:44
  • 阅读:827

translateMarker在android平台中不能使用

分类:nvue

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>  
2020-10-26 11:42 负责人:DCloud_Android_ST 分享
已邀请:
DCloud_Android_ST

DCloud_Android_ST

问题已确认。先不要用12px增加计量单位

DCloud_Android_ST

DCloud_Android_ST

HX2.9.6已修复

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