constlnglat=[120.14078,30.24105]consttitleV="三潭印月";constmapSelectList=[{label:'高德',value:'GD',},{label:'百度',value:'BD',},{label:'腾讯',value:'TX',}];uni.showActionSheet({itemList:mapSelectList.map(item=>item.label),success:async(res)=>{constselectedMapType=mapSelectList[res.tapIndex].value;constsrcV='ZJSBY-H5';//来源letwebUrl='';//跳转地址switch(selectedMapType){case'GD':webUrl=`https://uri.amap.com/marker?position=${lnglat.toString()}&name=${encodeURIComponent(titleV)}&coordinate=wgs84&callnative=1&src=${srcV}`;break;case'BD':webUrl=`https://api.map.baidu.com/marker?location=${lnglat.reverse().toString()}&title=${encodeURIComponent(titleV)}&output=html&coord_type=wgs84&src=${srcV}`;break;case'TX':constlnglat_TX=this.$wgs84togcj02(lnglat[0],lnglat[1]);webUrl=`https://apis.map.qq.com/uri/v1/marker?marker=coord:${lnglat_TX.reverse().toString()};title:${encodeURIComponent(titleV)}&coord_type=1&referer=${srcV}`;break;default:break;}console.log('webUrl',webUrl)window.open(webUrl,'_blank');}});效果图:
参考文档:
高德:https://lbs.amap.com/api/uri-api/gettingstarted
百度:https://lbsyun.baidu.com/docs/webapi?title=mapadjustment/uri/web
腾讯:https://lbs.qq.com/webApi/uriV1/uriGuide/uriWebMarker