// 创建map对象
this.mapContext = uni.createMapContext('map'); //测试轨迹  
this.mapContext.translateMarker({
markerId: 10,
destination: {
longitude: 25.040609, // 车辆即将移动到的下一个点的经度
latitude: 102.712251, // 车辆即将移动到的下一个点的纬度
},
autoRotate: true,
rotate: 20,
duration: 1000,
// 动画结束
animationEnd: function() {  
                        uni.showToast({  
                            title: '回放完成',  
                            duration: 1400,  
                            icon: 'none'  
                        });  
                },  
                fail(e) {  
                    console.log(e);  
                    // 轨迹回放失败回调    
                },  
            });                                    
            
            
            

            
4***@qq.com (作者)
{
"errMsg": "translateMarker:fail maps2.LatLng is not a constructor"
}
报的这个错误我在nvue可以成功执行
2024-08-14 15:45
DCloud_UNI_yuhe
回复 4***@qq.com: 我这里测试的vue和nvue都没有这个错误,你能给一下你的完整代码吗?
2024-08-14 16:05
4***@qq.com (作者)
longitude="longitude" :markers="marker" :polyline="polyline">
</map>
mapContext 已经在data定义
onReady() {
// 创建map对象
this.mapContext = uni.createMapContext('map'); //测试轨迹
},
this.mapContext.translateMarker({
markerId: 10,
destination: {
longitude: 25.040609, // 车辆即将移动到的下一个点的经度
latitude: 102.712251, // 车辆即将移动到的下一个点的纬度
},
autoRotate: true,
rotate: 20,
duration: 1000,
// 动画结束
animationEnd: function() {
2024-08-14 16:42
4***@qq.com (作者)
回复 DCloud_UNI_yuhe: 是否是因为编辑器版本不一样
2024-08-14 16:50