使用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()),就会自动打开一个新的页面,点击右下角绿标可以看到高德地图,腾讯地图等。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM