<template>
<view class="position-relative " :style="'height:'+height+'px'">
<map class="col-12" id="map" :markers="markers" :longitude="longitude" :latitude="latitude" :scale="14" show-location show-compass :style="'height:'+height+'px'"></map>
</view>
</template>
<script>
export default {
data() {
return {
longitude:"",
latitude:"",
height: 100, //页面高度
}
},
methods: {
},
onLoad(){
let that=this
uni.getLocation({
type: 'wgs84',
success: (res) => {
that.longitude = res.longitude
that.latitude = res.latitude
uni.createMapContext('map').moveToLocation({
longitude: res.longitude,
latitude: res.latitude
})
},
});
}
}
</script>
<style></style>