使用uniapp之-在微信小程序内打开腾讯地图app或高德地图app

坑点:

uniapp的button按钮open-type有launchApp,打开APP的功能,但是场景有使用限制,具体参考官方文档(https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html)

我的写法:

<template>
	<view>
		open by map app
	</view>
</template>
<script>
export default {
	onLoad() {
		uni.getLocation({
			success: res => {
				console.log('location success', res)
				uni.openLocation({
					latitude: res.latitude,
					longitude: res.longitude,
					scale: 18
				})
			}
		})
	}
}
</script>
<style lang="scss">
</style>

只要调用该接口(uni.openLocation()),就会自动打开一个新的页面,点击右下角绿标可以看到高德地图,腾讯地图等。

posted @ 2020-03-24 11:04  zoo-x  阅读(14041)  评论(0)    收藏  举报