小程序map组件
发布于 5 年前 作者 pingfu 4901 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

onReady() {

    this.mapCtx = wx.createMapContext(‘myMap’, this);

},

创建并返回 map 上下文 mapContext 对象后。

let markers = [{

         iconPath: “…/…/public/images/taxi.png”,

         id: 1,

         longitude: tripData.driverPoint[0],

         latitude: tripData.driverPoint[1],

         width: 22,

         height: 34

         // rotate: 0

       }];

移动并且旋转角度makers ,方法如下。

this.mapCtx.translateMarker({

       markerId: 1,

       rotate: rotatedeg || 0,

       duration: 6000,

       destination: {

         longitude,

         latitude

       }

});

在不切换到后台的情况下正常移动旋转,一旦切换到后台再返回,就只触发移动,无法旋转角度。

尝试将 this.mapCtx = wx.createMapContext(‘myMap’, this);放入onShow(){},多次切换后会出现旋转角度错误或者停止移动的问题。

  • 预期表现

切换到后台再返回的情况下能正常移动旋转

  • 复现路径
  • 提供一个最简复现 Demo
回到顶部