Skip to content

Commit cfa5abc

Browse files
committed
improvement & bug fixes of Google-Map component
1 parent 26a0e9f commit cfa5abc

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

TestApp/Sample.MapControl.html

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414

1515
<!-- sample styles -->
1616
<link href="Content/samples.css" rel="stylesheet" />
17-
<style>
18-
#myMap {
19-
width: 600px;
20-
height: 400px;
21-
}
22-
</style>
2317
</head>
2418
<body>
2519

@@ -45,7 +39,9 @@ <h1>Vue Samples Collection</h1>
4539
<h2>Live Example</h2>
4640
<div class="liveExample">
4741

48-
<google-map id="myMap" lat="-27.468" lng="153.025" zoom="10" :markers="markers"></google-map>
42+
<google-map id="myMap" :lat="-27.468" :lng="153.025" :zoom="10" :markers="markers"></google-map>
43+
<br />
44+
<google-map id="myMap2" :lat="-27.468" :lng="153.025" :zoom="12" :markers="markers"></google-map>
4945

5046
</div>
5147

TestApp/Sample.Modal.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ <h2>Live Example</h2>
4040
<modal :show.sync="showModal">
4141
<div slot="header">
4242
<h3>customized header</h3>
43+
<button @click="showModal = false">Hide</button>
4344
</div>
4445
<div slot="body">
4546
<p>Name <input type="text" /></p>

TestApp/ScriptsLocal/components/GoogleMap.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,23 @@ Vue.component('google-map', function (resolve, reject) {
3232
type: Number,
3333
required: false,
3434
},
35+
width: {
36+
type: String,
37+
required: false,
38+
default: '510pt',
39+
},
40+
height: {
41+
type: String,
42+
required: false,
43+
default: '340pt',
44+
},
3545
markers: null,
3646
},
3747
attached: function () {
3848
var getv = function (x, y) { return x == undefined ? y : x; };
39-
var lat;
49+
var mm = this.$el;
50+
mm.style.width = this.width;
51+
mm.style.height = this.height;
4052
var map = new google.maps.Map(this.$el, {
4153
center: new google.maps.LatLng(getv(this.lat, -27.468), getv(this.lng, 153.025)),
4254
zoom: getv(this.zoom, 10),

TestApp/ScriptsLocal/components/GoogleMap.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,23 @@ Vue.component('google-map', function (resolve, reject) {
3333
type: Number,
3434
required: false,
3535
},
36+
width: {
37+
type: String,
38+
required: false,
39+
default: '510pt',
40+
},
41+
height: {
42+
type: String,
43+
required: false,
44+
default: '340pt',
45+
},
3646
markers: null, // google.maps.LatLng | google.maps.LatLng[]
3747
},
3848
attached: function () {
3949
var getv = (x, y) => x == undefined ? y : x;
40-
var lat
50+
var mm: HTMLElement = this.$el;
51+
mm.style.width = this.width;
52+
mm.style.height = this.height;
4153
var map = new google.maps.Map(this.$el, {
4254
center: new google.maps.LatLng(getv(this.lat, -27.468), getv(this.lng, 153.025)),
4355
zoom: getv(this.zoom, 10),

0 commit comments

Comments
 (0)