维基小程序
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.
 
 
 

49 lines
1023 B

<template>
<map
:latitude="latitude"
:longitude="longitude"
:markers="markers"
:polygons="polygons"
:polyline="polyline"
id="map"
ref="map"
show-location="true"
style="width: 100%; height: 1000rpx;"
/>
</template>
<script>
export default {
props: {
markers: { type: Array, default: null },
polyline: { type: Array, default: null },
polygons: { type: Array, default: null },
},
data() {
return {
latitude: 37.87059,
longitude: 112.55067,
};
},
onLoad() {
this.getLocation();
},
methods: {
// 获取当前的地址位置
// 注意用国测局的数据 map只支持gcj02
getLocation() {
uni.getLocation({
type: 'gcj02',
success: res => {
this.longitude = res.longitude;
this.latitude = res.latitude;
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
},
});
},
},
};
</script>