Skip to content

Commit e661041

Browse files
committed
chore(release): 3.0.4
1 parent 4d5520c commit e661041

7 files changed

+2722
-15
lines changed

Diff for: dist/vue-router.common.js

+32-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-router v3.0.3
2+
* vue-router v3.0.4
33
* (c) 2019 Evan You
44
* @license MIT
55
*/
@@ -2337,7 +2337,23 @@ function getHash () {
23372337
// consistent across browsers - Firefox will pre-decode it!
23382338
var href = window.location.href;
23392339
var index = href.indexOf('#');
2340-
return index === -1 ? '' : decodeURI(href.slice(index + 1))
2340+
// empty path
2341+
if (index < 0) { return '' }
2342+
2343+
href = href.slice(index + 1);
2344+
// decode the hash but not the search or hash
2345+
// as search(query) is already decoded
2346+
// https://github.com/vuejs/vue-router/issues/2708
2347+
var searchIndex = href.indexOf('?');
2348+
if (searchIndex < 0) {
2349+
var hashIndex = href.indexOf('#');
2350+
if (hashIndex > -1) { href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex); }
2351+
else { href = decodeURI(href); }
2352+
} else {
2353+
if (searchIndex > -1) { href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex); }
2354+
}
2355+
2356+
return href
23412357
}
23422358

23432359
function getUrl (path) {
@@ -2488,7 +2504,19 @@ VueRouter.prototype.init = function init (app /* Vue component instance */) {
24882504

24892505
this.apps.push(app);
24902506

2491-
// main app already initialized.
2507+
// set up app destroyed handler
2508+
// https://github.com/vuejs/vue-router/issues/2639
2509+
app.$once('hook:destroyed', function () {
2510+
// clean out app from this.apps array once destroyed
2511+
var index = this$1.apps.indexOf(app);
2512+
if (index > -1) { this$1.apps.splice(index, 1); }
2513+
// ensure we still have a main app or null if no apps
2514+
// we do not release the router so it can be reused
2515+
if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
2516+
});
2517+
2518+
// main app previously initialized
2519+
// return as we don't need to set up new history listener
24922520
if (this.app) {
24932521
return
24942522
}
@@ -2622,7 +2650,7 @@ function createHref (base, fullPath, mode) {
26222650
}
26232651

26242652
VueRouter.install = install;
2625-
VueRouter.version = '3.0.3';
2653+
VueRouter.version = '3.0.4';
26262654

26272655
if (inBrowser && window.Vue) {
26282656
window.Vue.use(VueRouter);

0 commit comments

Comments
 (0)