H5中,跳转高德腾讯百度地图,导航到目的地

manifest.json

在这里插入图片描述

 // 目标经纬度,标题
let lat = this.detail.latitude;
let lng = this.detail.longitude;
let title = this.detail.name;
let key = 'QV3BZ-******-X4BPU'; // 腾讯地图key
let url = ''
if(index == 0){
    
    
	// 腾讯地址
	url = `http://apis.map.qq.com/uri/v1/marker?marker=coord:${
      
      lat},${
      
      lng};title:${
      
      title};addr:${
      
      title}&referer=${
      
      key}`;
}else if(index == 1){
    
    
	// 百度地图
	let baiduUrl = `marker?location=${
      
      lat},${
      
      lng}&title=${
      
      title}&content=${
      
      title}`;
	url = `https://api.map.baidu.com/${
      
      baiduUrl}&output=html&src=webapp.baidu.openAPIdemo`;
}else if(index == 2){
    
    
	// 高德地图
	url = `https://uri.amap.com/marker?position=${
      
      lng},${
      
      lat}&name=${
      
      title}&src=mypage&coordinate=gaode&callnative=1`;
}
location.href = url;

猜你喜欢

转载自blog.csdn.net/qq_40745143/article/details/131374226
今日推荐