看看你的latitude: list[0],longitude: list[1]是不是string类型的,MapContext.openMapApp中的经度和纬度参数不支持string,建议先使用number()转成数字类型试试
调用MapContext.openMapApp走fail?<view class="map" bindtap="gonavigation"> <map id="map" longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markers}}" scale="16" style=" width: 100%; height: 500rpx;"></map> </view> gonavigation() { let that = this; let list = that.data.cooperateInfo.coordinate.split(','); const mapCtx = wx.createMapContext('map', that); mapCtx.openMapApp({ latitude: list[0], longitude: list[1], destination: that.data.cooperateInfo.name, success:()=>{ console.log('导航触发成功'); }, fail:()=>{ console.log('导航触发失败'); }, }); } 点击之后返回走fail() 导航出发失败 代码看着没错啊 怎么回事啊 怎么才能调起选择导航方式的窗口啊
2024-08-28