fix pushState event (#434)
This commit is contained in:
@@ -57,7 +57,12 @@ function Framework (opts) {
|
|||||||
|
|
||||||
if (opts.history !== false) {
|
if (opts.history !== false) {
|
||||||
onHistoryChange(function (href) {
|
onHistoryChange(function (href) {
|
||||||
bus.emit('pushState', window.location.href)
|
bus.emit('pushState')
|
||||||
|
})
|
||||||
|
|
||||||
|
bus.on('pushState', function (href) {
|
||||||
|
if (href) window.history.pushState({}, null, href)
|
||||||
|
bus.emit('render')
|
||||||
scrollIntoView()
|
scrollIntoView()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -66,10 +71,7 @@ function Framework (opts) {
|
|||||||
var href = location.href
|
var href = location.href
|
||||||
var currHref = window.location.href
|
var currHref = window.location.href
|
||||||
if (href === currHref) return
|
if (href === currHref) return
|
||||||
window.history.pushState({}, null, href)
|
bus.emit('pushState', href)
|
||||||
bus.emit('pushState', window.location.href)
|
|
||||||
bus.emit('render')
|
|
||||||
scrollIntoView()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user