mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
Update router.js
This commit is contained in:
parent
5f55bf76bd
commit
a89a0f7ca9
@ -56,8 +56,6 @@ const scrollBehavior = function (to, from, savedPosition) {
|
|||||||
if (to.hash) {
|
if (to.hash) {
|
||||||
let hash = to.hash
|
let hash = to.hash
|
||||||
// CSS.escape() is not supported with IE and Edge.
|
// CSS.escape() is not supported with IE and Edge.
|
||||||
// But we can use the following polyfill to solve this problem.
|
|
||||||
// https://github.com/mathiasbynens/CSS.escape
|
|
||||||
if (typeof window.CSS !== 'undefined' && typeof window.CSS.escape !== 'undefined') {
|
if (typeof window.CSS !== 'undefined' && typeof window.CSS.escape !== 'undefined') {
|
||||||
hash = '#' + window.CSS.escape(hash.substr(1))
|
hash = '#' + window.CSS.escape(hash.substr(1))
|
||||||
}
|
}
|
||||||
@ -67,7 +65,7 @@ const scrollBehavior = function (to, from, savedPosition) {
|
|||||||
position = { selector: hash }
|
position = { selector: hash }
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('failed to save the scroll position. possibly this problem can be solved using a polyfill for CSS.escape().')
|
console.warn('Failed to save scroll position. Please add CSS.escape() polyfill (https://github.com/mathiasbynens/CSS.escape).')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve(position)
|
resolve(position)
|
||||||
|
Loading…
Reference in New Issue
Block a user