forked from GuillaumeLeclerc/vue-google-maps
-
Notifications
You must be signed in to change notification settings - Fork 475
/
resize-bus.html
82 lines (70 loc) · 1.58 KB
/
resize-bus.html
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
<body>
<div id="root">
<h1>Resize Bus</h1>
<p>
The first map is displayed correctly after clicking
the button.
The second and third are not (not bound to default resize bus).
<button @click=updateStyle>
Click me first
</button>
</p>
<p>
However, the third map responds to the second button
(custom resize bus)
<button @click=updateBus>
Click me second
</button>
</p>
<gmap-map
:style="currentStyle"
:center="{lat: 1.38, lng: 103.8}"
:zoom=12>
</gmap-map>
<gmap-map
:style="currentStyle"
:center="{lat: 1.38, lng: 103.8}"
:zoom=12
:resize-bus="null">
</gmap-map>
<gmap-map
:style="currentStyle"
:center="{lat: 1.38, lng: 103.8}"
:zoom=12
:resize-bus="customBus">
</gmap-map>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.0/vue.js"></script>
<script src="vue-google-maps.js"></script>
<script>
Vue.use(VueGoogleMaps, {
load: {
key: 'AIzaSyDf43lPdwlF98RCBsJOFNKOkoEjkwxb5Sc',
},
});
document.addEventListener('DOMContentLoaded', function() {
new Vue({
el: '#root',
data: {
currentStyle: {
display: 'none'
},
customBus: new Vue(),
},
methods: {
updateStyle() {
this.currentStyle = {
display: 'inline-block',
width: '200px',
height: '200px',
};
Vue.$gmapDefaultResizeBus.$emit('resize');
},
updateBus() {
this.customBus.$emit('resize');
}
}
});
});
</script>
</body>