map.vue
916 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<template>
<view :style="{height:mapHeight}">
<map style="width: 100%; height: 100%;" :latitude="latitude" :longitude="longitude"></map>
</view>
</template>
<script>
export default {
data() {
return {
mapHeight:0,
latitude: 0,
longitude: 0
}
},
onLoad() {
uni.getSystemInfo({
success: (res) => {
//#ifdef APP-PLUS
this.mapHeight = res.windowHeight*2 + res.statusBarHeight*2 +'rpx'
//#endif
//#ifdef H5
this.mapHeight = res.windowHeight*2+'rpx'
//#endif
}
})
//#ifdef APP-PLUS
uni.getLocation({
type: 'gcj02',
geocode: true,
success: (res) => {
this.latitude = res.latitude
this.longitude = res.longitude
}
});
//#endif
//#ifdef H5
this.latitude = 39.086126
this.longitude = 117.122802
//#endif
},
methods: {
}
}
</script>
<style>
.mapWrap{background: #007AFF;}
</style>