Skip to content

Commit fac60f6

Browse files
JounQinyyx990803
authored andcommittedOct 24, 2017
fix: only setupScroll when support pushState due to possible fallback: false (#1835)
* fix #1834 * judge supportsPushState before setupScroll * expectScroll -> supportsScroll
1 parent 9eecbd9 commit fac60f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎src/history/html5.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ import { History } from './base'
55
import { cleanPath } from '../util/path'
66
import { START } from '../util/route'
77
import { setupScroll, handleScroll } from '../util/scroll'
8-
import { pushState, replaceState } from '../util/push-state'
8+
import { pushState, replaceState, supportsPushState } from '../util/push-state'
99

1010
export class HTML5History extends History {
1111
constructor (router: Router, base: ?string) {
1212
super(router, base)
1313

1414
const expectScroll = router.options.scrollBehavior
15+
const supportsScroll = supportsPushState && expectScroll
1516

16-
if (expectScroll) {
17+
if (supportsScroll) {
1718
setupScroll()
1819
}
1920

@@ -29,7 +30,7 @@ export class HTML5History extends History {
2930
}
3031

3132
this.transitionTo(location, route => {
32-
if (expectScroll) {
33+
if (supportsScroll) {
3334
handleScroll(router, route, current, true)
3435
}
3536
})

0 commit comments

Comments
 (0)