File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ import { setupScroll, handleScroll } from '../util/scroll'
8
8
import { pushState , replaceState , supportsPushState } from '../util/push-state'
9
9
10
10
export class HashHistory extends History {
11
- constructor ( router : Router , base : ?string , fallback : boolean ) {
11
+ constructor ( router : Router , base : ?string ) {
12
12
super ( router , base )
13
13
// check history fallback deeplinking
14
- if ( fallback && checkFallback ( this . base ) ) {
14
+ if ( checkFallback ( this . base ) ) {
15
15
return
16
16
}
17
17
ensureSlash ( )
@@ -80,10 +80,13 @@ export class HashHistory extends History {
80
80
81
81
function checkFallback ( base ) {
82
82
const location = getLocation ( base )
83
- if ( ! / ^ \/ # / . test ( location ) ) {
84
- window . location . replace (
85
- cleanPath ( base + '/#' + location )
86
- )
83
+ if ( location !== '/' && ! / ^ \/ # / . test ( location ) ) {
84
+ const path = cleanPath ( base + '/#' + location )
85
+ if ( supportsPushState ) {
86
+ replaceState ( path )
87
+ } else {
88
+ window . location . replace ( path )
89
+ }
87
90
return true
88
91
}
89
92
}
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ export default class VueRouter {
56
56
this . history = new HTML5History ( this , options . base )
57
57
break
58
58
case 'hash' :
59
- this . history = new HashHistory ( this , options . base , this . fallback )
59
+ this . history = new HashHistory ( this , options . base )
60
60
break
61
61
case 'abstract' :
62
62
this . history = new AbstractHistory ( this , options . base )
You can’t perform that action at this time.
0 commit comments