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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
| <template>
| <div class="location-message" :class="{ full: full }">
| <baidu-map
| class="bm-view"
| :center="center"
| :zoom="zoom"
| @ready="handler"
| >
| </baidu-map>
|
| <div class="icon" title="放大/缩放" @click="full = !full">
| <i class="el-icon-zoom-in" v-if="!full"></i>
| <i class="el-icon-zoom-out" v-else></i>
| </div>
| </div>
| </template>
|
| <script>
|
| export default {
| name: 'LocationMessage',
| props: {
| lng: 0,
| lat: 0,
| },
| data() {
| return {
| center: { lng: 0, lat: 0 },
| zoom: 0,
| full: false,
| }
| },
| methods: {
| handler({ BMap, map }) {
| this.center.lng = this.lng
| this.center.lat = this.lat
| this.zoom = 13
| },
| },
| }
| </script>
| <style lang="less" scoped>
| .location-message {
| width: 100%;
| max-width: 300px;
| height: 150px;
| background: rgb(240, 238, 241);
| border-radius: 3px;
| overflow: hidden;
| position: relative;
|
| &.full {
| max-width: none;
| height: 300px;
| }
|
| .icon {
| position: absolute;
| right: 10px;
| top: 10px;
| width: 30px;
| height: 30px;
| display: flex;
| align-items: center;
| justify-content: center;
| cursor: pointer;
| font-size: 20px;
| }
| }
|
| .bm-view {
| width: 100%;
| height: 100%;
|
| /deep/.anchorBL {
| display: none;
| }
| /deep/.BMap_cpyCtrl {
| display: none;
| }
| }
| </style>
|
|