We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8b6aa3a + 664dcd7 commit 04adba1Copy full SHA for 04adba1
packages/router/history.js
@@ -5,14 +5,19 @@ import {
5
export var modeObject = {}
6
//伪造一个Location对象
7
function getLocation(source) {
8
- return {
9
- ...source.location,
+ const location = {
10
getPath() {
11
return modeObject.value === "hash" ? this.hash.slice(1) : this.pathname
12
},
13
state: source.history.state,
14
key: (source.history.state && source.history.state.key) || "initial"
15
};
+ for (const key in source.location) {
16
+ if (Object.prototype.hasOwnProperty.call(source.location, key)) {
17
+ location[key] = source.location[key];
18
+ }
19
20
+ return location;
21
}
22
23
//伪造一个History对象
@@ -175,4 +180,4 @@ export {
175
180
navigate,
176
181
createHistory,
177
182
createMemorySource
178
-};
183
+};
0 commit comments