Skip to content
Permalink
Browse files
fix: only setupScroll when support pushState due to possible fallback…
…: false (#1835)

* fix #1834

* judge supportsPushState before setupScroll

* expectScroll -> supportsScroll
  • Loading branch information
JounQin authored and yyx990803 committed Oct 24, 2017
1 parent 9eecbd9 commit fac60f63401be86c5a76124782de28f600e7694b
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/history/html5.js
@@ -5,15 +5,16 @@ import { History } from './base'
import { cleanPath } from '../util/path'
import { START } from '../util/route'
import { setupScroll, handleScroll } from '../util/scroll'
import { pushState, replaceState } from '../util/push-state'
import { pushState, replaceState, supportsPushState } from '../util/push-state'

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

const expectScroll = router.options.scrollBehavior
const supportsScroll = supportsPushState && expectScroll

if (expectScroll) {
if (supportsScroll) {
setupScroll()
}

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

this.transitionTo(location, route => {
if (expectScroll) {
if (supportsScroll) {
handleScroll(router, route, current, true)
}
})

0 comments on commit fac60f6

Please sign in to comment.