如何打开第三方app
// namespace: "open Map"
<template>
<div>
<button @click="openOthersMapPage('baidu')">打开百度地图</button>
<button @click="openOthersMapPage('tengxun')">打开腾讯地图</button>
<button @click="openOthersMapPage('gaode')">打开高德地图</button>
</div>
</template>
<script>
export default {
name: "aaaa",
setup() {
const location = {
lat: 39.9,
lng: 116.4,
address: "北京故宫博物院",
};
const openMap = (location, mapType) => {
const { lat, lng, address } = location;
let url = "";
switch (mapType) {
case "tengxun":
url =
"https://apis.map.qq.com/uri/v1/marker?marker=coord:" +
lat +
"," +
lng +
";addr:" +
address +
";title:地址&referer=keyfree";
break;
case "gaode":
url =
"https://uri.amap.com/marker?position=" +
lng +
"," +
lat +
"&name=" +
address +
"&callnative=1";
break;
case "baidu":
url =
"http://api.map.baidu.com/marker?location=" +
lat +
"," +
lng +
"&title=地址&content=" +
address +
"&output=html&src=webapp.reformer.appname&coord_type=gcj02";
break;
default:
break;
}
window.open(url);
};
const openOthersMapPage = (type) => {
openMap(location, type);
};
return { openOthersMapPage };
},
};
</script>