fix: fix scroll timing
This commit is contained in:
parent
0ec32cc672
commit
42f4ec1673
@ -1,6 +1,13 @@
|
|||||||
export default function scrollBehavior (to) {
|
function timeout (t) {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
setTimeout(resolve, t)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function scrollBehavior (to) {
|
||||||
if (to.hash) {
|
if (to.hash) {
|
||||||
// scroll to anchor by returning the selector
|
// scroll to anchor by returning the selector
|
||||||
|
await timeout(0)
|
||||||
return {
|
return {
|
||||||
selector: decodeURIComponent(to.hash),
|
selector: decodeURIComponent(to.hash),
|
||||||
offset: {
|
offset: {
|
||||||
|
Loading…
Reference in New Issue
Block a user