坐标拾取器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

45 lines
834 B

<template>
<view>
<view class="location">
<view>经度{{longitude}}</view>
<view>纬度{{latitude}}</view>
</view>
<button class="center-btn" @click="showMeLocation">我在哪</button>
</view>
</template>
<script>
export default {
data() {
return {
longitude:'',
latitude:''
}
},
methods: {
showMeLocation(){
let this_ = this;
uni.getLocation({
type: 'gcj02',
success: function (res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
this_.longitude = res.longitude;
this_.latitude = res.latitude;
}
});
}
}
}
</script>
<style lang="scss" scoped>
.location{
padding: 40rpx;
margin: 50rpx 20rpx;
background-color: #eee;
}
.center-btn{
margin: 0 50rpx;
}
</style>