Skip to content

Commit d96e444

Browse files
author
wanyaxing
committed
Merge branch 'add-replace-attr-in-location' into dev
2 parents 503c83b + 538ce60 commit d96e444

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/history/hash.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ export class HashHistory extends History {
5555

5656
replace (location: RawLocation, onComplete?: Function, onAbort?: Function) {
5757
const { current: fromRoute } = this
58-
if (typeof location === 'string'){
59-
location = {path:location}
58+
if (typeof location === 'string') {
59+
location = { path: location }
6060
}
61-
if (typeof location === 'object' && !location.replace){
62-
location.replace = 1
61+
if (typeof location === 'object' && !location.replace) {
62+
(location: Object).replace = true
6363
}
6464
this.transitionTo(location, route => {
6565
replaceHash(route.fullPath)

src/history/html5.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ export class HTML5History extends History {
5252

5353
replace (location: RawLocation, onComplete?: Function, onAbort?: Function) {
5454
const { current: fromRoute } = this
55-
if (typeof location === 'string'){
56-
location = {path:location}
55+
if (typeof location === 'string') {
56+
location = { path: location }
5757
}
58-
if (typeof location === 'object' && !location.replace){
59-
location.replace = 1
58+
if (typeof location === 'object' && !location.replace) {
59+
(location: Object).replace = true
6060
}
6161
this.transitionTo(location, route => {
6262
replaceState(cleanPath(this.base + route.fullPath))

src/util/route.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function createRoute (
2323
meta: (record && record.meta) || {},
2424
path: location.path || '/',
2525
hash: location.hash || '',
26-
replace: location.replace || 0,
26+
replace: location.replace || false,
2727
query,
2828
params: location.params || {},
2929
fullPath: getFullPath(location, stringifyQuery),

0 commit comments

Comments
 (0)