Browse Source

Pull request #1698: BI-78918 fix: 解码报错问题

Merge in VISUAL/fineui from ~WINDY/fui:master to master

* commit '5cdf9628675b16f0b8f17ce298c638928c5baf18':
  BI-78918 fix: 解码报错问题
es6
windy 4 years ago
parent
commit
e0061cbabd
  1. 21
      src/router/router.js

21
src/router/router.js

@ -298,7 +298,14 @@
return _.map(params, function (param, i) {
// Don't decode the search params.
if (i === params.length - 1) return param || null;
return param ? decodeURIComponent(param) : null;
var resultParam = null;
if (param) {
try {
resultParam = decodeURIComponent(param);
} catch (e) {
}
}
return resultParam;
});
}
@ -364,7 +371,11 @@
// Get the pathname and search params, without the root.
getPath: function () {
var path = decodeURI(this.location.pathname + this.getSearch());
var path = this.location.pathname + this.getSearch();
try {
path = decodeURI(path);
} catch(e) {
}
var root = this.root.slice(0, -1);
if (!path.indexOf(root)) path = path.slice(root.length);
return path.charAt(0) === "/" ? path.slice(1) : path;
@ -552,7 +563,11 @@
var url = root + fragment;
// Strip the hash and decode for matching.
fragment = decodeURI(fragment.replace(pathStripper, ""));
fragment = fragment.replace(pathStripper, "")
try {
fragment = decodeURI(fragment);
} catch(e) {
}
if (this.fragment === fragment) return;
this.fragment = fragment;

Loading…
Cancel
Save