Skip to content

Commit 43660a6

Browse files
committed
Version 0.3.2
2 parents 66aac6c + 0cf07c5 commit 43660a6

File tree

10 files changed

+64
-41
lines changed

10 files changed

+64
-41
lines changed

dist/vue-mapbox.common.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,7 @@ module.exports = /******/ (function(modules) {
25302530
// Indicate to webpack that this file can be concatenated
25312531
/* harmony default export */ var setPublicPath = null;
25322532

2533-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"47f5d000-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/map/GlMap.vue?vue&type=template&id=177ac976&
2533+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"47f5d000-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/map/GlMap.vue?vue&type=template&id=a6b1c212&
25342534
var render = function() {
25352535
var _vm = this;
25362536
var _h = _vm.$createElement;
@@ -2551,7 +2551,7 @@ module.exports = /******/ (function(modules) {
25512551
}
25522552
];
25532553

2554-
// CONCATENATED MODULE: ./src/components/map/GlMap.vue?vue&type=template&id=177ac976&
2554+
// CONCATENATED MODULE: ./src/components/map/GlMap.vue?vue&type=template&id=a6b1c212&
25552555

25562556
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom.iterable.js
25572557
var web_dom_iterable = __webpack_require__("ac6a");
@@ -3320,7 +3320,11 @@ module.exports = /******/ (function(modules) {
33203320
});
33213321
},
33223322
beforeDestroy: function beforeDestroy() {
3323-
if (this.map) this.map.remove();
3323+
var _this2 = this;
3324+
3325+
this.$nextTick(function() {
3326+
if (_this2.map) _this2.map.remove();
3327+
});
33243328
}
33253329
};
33263330
// CONCATENATED MODULE: ./src/components/map/GlMap.vue?vue&type=script&lang=js&
@@ -3482,6 +3486,7 @@ module.exports = /******/ (function(modules) {
34823486
var _this2 = this;
34833487

34843488
if (events.length === 0) return;
3489+
if (!emitter) return;
34853490
events.forEach(function(eventName) {
34863491
emitter.off(eventName, _this2.$_emitSelfEvent);
34873492
});
@@ -3501,7 +3506,7 @@ module.exports = /******/ (function(modules) {
35013506
}
35023507
},
35033508
beforeDestroy: function beforeDestroy() {
3504-
if (this.map) {
3509+
if (this.map && this.control) {
35053510
this.map.removeControl(this.control);
35063511
}
35073512
},
@@ -4233,7 +4238,7 @@ module.exports = /******/ (function(modules) {
42334238
}
42344239
},
42354240
beforeDestroy: function beforeDestroy() {
4236-
if (this.map) {
4241+
if (this.map && this.map.loaded()) {
42374242
try {
42384243
this.map.removeLayer(this.layerId);
42394244
} catch (err) {
@@ -4277,13 +4282,15 @@ module.exports = /******/ (function(modules) {
42774282
$_unbindEvents: function $_unbindEvents(events) {
42784283
var _this2 = this;
42794284

4280-
events.forEach(function(eventName) {
4281-
_this2.map.off(
4282-
eventName,
4283-
_this2.layerId,
4284-
_this2.$_emitLayerMapEvent
4285-
);
4286-
});
4285+
if (this.map) {
4286+
events.forEach(function(eventName) {
4287+
_this2.map.off(
4288+
eventName,
4289+
_this2.layerId,
4290+
_this2.$_emitLayerMapEvent
4291+
);
4292+
});
4293+
}
42874294
},
42884295
$_watchSourceLoading: function $_watchSourceLoading(data) {
42894296
if (data.dataType === "source" && data.sourceId === this.sourceId) {
@@ -4485,7 +4492,7 @@ module.exports = /******/ (function(modules) {
44854492
this.$_addLayer();
44864493
this.$_bindLayerEvents(layerEvents);
44874494
this.map.off("dataloading", this.$_watchSourceLoading);
4488-
this.initial = false; // payload.component.$off("load", this.$_deferredMount);
4495+
this.initial = false;
44894496
},
44904497
$_addLayer: function $_addLayer() {
44914498
var existed = this.map.getLayer(this.layerId);

dist/vue-mapbox.umd.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,7 +2566,7 @@
25662566
// Indicate to webpack that this file can be concatenated
25672567
/* harmony default export */ var setPublicPath = null;
25682568

2569-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"47f5d000-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/map/GlMap.vue?vue&type=template&id=177ac976&
2569+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"47f5d000-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/map/GlMap.vue?vue&type=template&id=a6b1c212&
25702570
var render = function() {
25712571
var _vm = this;
25722572
var _h = _vm.$createElement;
@@ -2590,7 +2590,7 @@
25902590
}
25912591
];
25922592

2593-
// CONCATENATED MODULE: ./src/components/map/GlMap.vue?vue&type=template&id=177ac976&
2593+
// CONCATENATED MODULE: ./src/components/map/GlMap.vue?vue&type=template&id=a6b1c212&
25942594

25952595
// EXTERNAL MODULE: ./node_modules/core-js/modules/web.dom.iterable.js
25962596
var web_dom_iterable = __webpack_require__("ac6a");
@@ -3368,7 +3368,11 @@
33683368
});
33693369
},
33703370
beforeDestroy: function beforeDestroy() {
3371-
if (this.map) this.map.remove();
3371+
var _this2 = this;
3372+
3373+
this.$nextTick(function() {
3374+
if (_this2.map) _this2.map.remove();
3375+
});
33723376
}
33733377
};
33743378
// CONCATENATED MODULE: ./src/components/map/GlMap.vue?vue&type=script&lang=js&
@@ -3530,6 +3534,7 @@
35303534
var _this2 = this;
35313535

35323536
if (events.length === 0) return;
3537+
if (!emitter) return;
35333538
events.forEach(function(eventName) {
35343539
emitter.off(eventName, _this2.$_emitSelfEvent);
35353540
});
@@ -3549,7 +3554,7 @@
35493554
}
35503555
},
35513556
beforeDestroy: function beforeDestroy() {
3552-
if (this.map) {
3557+
if (this.map && this.control) {
35533558
this.map.removeControl(this.control);
35543559
}
35553560
},
@@ -4287,7 +4292,7 @@
42874292
}
42884293
},
42894294
beforeDestroy: function beforeDestroy() {
4290-
if (this.map) {
4295+
if (this.map && this.map.loaded()) {
42914296
try {
42924297
this.map.removeLayer(this.layerId);
42934298
} catch (err) {
@@ -4331,13 +4336,15 @@
43314336
$_unbindEvents: function $_unbindEvents(events) {
43324337
var _this2 = this;
43334338

4334-
events.forEach(function(eventName) {
4335-
_this2.map.off(
4336-
eventName,
4337-
_this2.layerId,
4338-
_this2.$_emitLayerMapEvent
4339-
);
4340-
});
4339+
if (this.map) {
4340+
events.forEach(function(eventName) {
4341+
_this2.map.off(
4342+
eventName,
4343+
_this2.layerId,
4344+
_this2.$_emitLayerMapEvent
4345+
);
4346+
});
4347+
}
43414348
},
43424349
$_watchSourceLoading: function $_watchSourceLoading(data) {
43434350
if (
@@ -4546,7 +4553,7 @@
45464553
this.$_addLayer();
45474554
this.$_bindLayerEvents(layerEvents);
45484555
this.map.off("dataloading", this.$_watchSourceLoading);
4549-
this.initial = false; // payload.component.$off("load", this.$_deferredMount);
4556+
this.initial = false;
45504557
},
45514558
$_addLayer: function $_addLayer() {
45524559
var existed = this.map.getLayer(this.layerId);

dist/vue-mapbox.umd.min.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,10 @@
21842184
});
21852185
},
21862186
beforeDestroy: function() {
2187-
this.map && this.map.remove();
2187+
var t = this;
2188+
this.$nextTick(function() {
2189+
t.map && t.map.remove();
2190+
});
21882191
}
21892192
},
21902193
S = x;
@@ -2254,6 +2257,7 @@
22542257
$_unbindSelfEvents: function(t, e) {
22552258
var n = this;
22562259
0 !== t.length &&
2260+
e &&
22572261
t.forEach(function(t) {
22582262
e.off(t, n.$_emitSelfEvent);
22592263
});
@@ -2265,7 +2269,7 @@
22652269
inject: ["mapbox", "map", "actions"],
22662270
props: { position: { type: String, default: "top-right" } },
22672271
beforeDestroy: function() {
2268-
this.map && this.map.removeControl(this.control);
2272+
this.map && this.control && this.map.removeControl(this.control);
22692273
},
22702274
methods: {
22712275
$_addControl: function() {
@@ -2683,7 +2687,7 @@
26832687
);
26842688
},
26852689
beforeDestroy: function() {
2686-
if (this.map) {
2690+
if (this.map && this.map.loaded()) {
26872691
try {
26882692
this.map.removeLayer(this.layerId);
26892693
} catch (t) {
@@ -2715,9 +2719,10 @@
27152719
},
27162720
$_unbindEvents: function(t) {
27172721
var e = this;
2718-
t.forEach(function(t) {
2719-
e.map.off(t, e.layerId, e.$_emitLayerMapEvent);
2720-
});
2722+
this.map &&
2723+
t.forEach(function(t) {
2724+
e.map.off(t, e.layerId, e.$_emitLayerMapEvent);
2725+
});
27212726
},
27222727
$_watchSourceLoading: function(t) {
27232728
"source" === t.dataType &&

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-mapbox",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"author": {
55
"name": "soal",
66
"email": "[email protected]",

src/components/UI/controls/controlMixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default {
1515
},
1616

1717
beforeDestroy() {
18-
if (this.map) {
18+
if (this.map && this.control) {
1919
this.map.removeControl(this.control);
2020
}
2121
},

src/components/UI/withSelfEvents.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default {
1717

1818
$_unbindSelfEvents(events, emitter) {
1919
if (events.length === 0) return;
20+
if (!emitter) return;
2021
events.forEach(eventName => {
2122
emitter.off(eventName, this.$_emitSelfEvent);
2223
});

src/components/layer/GeojsonLayer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ export default {
122122
this.$_bindLayerEvents(layerEvents);
123123
this.map.off("dataloading", this.$_watchSourceLoading);
124124
this.initial = false;
125-
// payload.component.$off("load", this.$_deferredMount);
126125
},
127126

128127
$_addLayer() {

src/components/layer/layerMixin.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default {
128128
},
129129

130130
beforeDestroy() {
131-
if (this.map) {
131+
if (this.map && this.map.loaded()) {
132132
try {
133133
this.map.removeLayer(this.layerId);
134134
} catch (err) {
@@ -164,9 +164,11 @@ export default {
164164
},
165165

166166
$_unbindEvents(events) {
167-
events.forEach(eventName => {
168-
this.map.off(eventName, this.layerId, this.$_emitLayerMapEvent);
169-
});
167+
if (this.map) {
168+
events.forEach(eventName => {
169+
this.map.off(eventName, this.layerId, this.$_emitLayerMapEvent);
170+
});
171+
}
170172
},
171173

172174
$_watchSourceLoading(data) {

src/components/map/GlMap.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ export default {
100100
},
101101
102102
beforeDestroy() {
103-
if (this.map) this.map.remove();
103+
this.$nextTick(() => {
104+
if (this.map) this.map.remove();
105+
});
104106
}
105107
};
106108
</script>

0 commit comments

Comments
 (0)