<script setup>
import { ref, onMounted } from 'vue';
import { onLoad } from '@dcloudio/uni-app';

const getAddress = () => {
	uni.chooseLocation({
		success: res => {
			console.log(res);
			console.log('位置名称：' + res.name);
			console.log('详细地址：' + res.address);
			console.log('纬度：' + res.latitude);
			console.log('经度：' + res.longitude);
		}
	});
}

</script>

<template>
 <button @click="getAddress">获取定位</button>

</template>