File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
examples/sites/src/views/components Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -459,7 +459,7 @@ export default defineComponent({
459
459
})
460
460
}
461
461
}
462
- }, 600 )
462
+ }, 0 )
463
463
}
464
464
465
465
// 在singleDemo情况时,才需要滚动示例区域到顶
@@ -565,7 +565,12 @@ export default defineComponent({
565
565
}
566
566
567
567
// F5刷新加载时,跳到当前示例
568
- scrollByHash(hash)
568
+ // 应当在所有demo渲染完毕后在滚动,否则滚动完位置后,demo渲染会使滚动位置错位
569
+ setTimeout(() => {
570
+ nextTick(() => {
571
+ scrollByHash(hash)
572
+ })
573
+ }, 0)
569
574
})
570
575
.finally(() => {
571
576
// 获取组件贡献者
@@ -652,12 +657,14 @@ export default defineComponent({
652
657
653
658
router.push(data.link)
654
659
} else if (apiModeState.demoMode === 'default' && data.link.startsWith('#')) {
660
+ e.preventDefault()
655
661
// 多示例模式,自动会切到相应的位置。只需要记录singleDemo就好了
656
662
const hash = data.link.slice(1)
657
663
state.currDemoId = hash
658
664
state.singleDemo = state.currJson.demos.find((d) => d.demoId === hash)
659
665
660
- e.preventDefault()
666
+ router.push(data.link)
667
+ scrollByHash(hash)
661
668
}
662
669
}
663
670
}
You can’t perform that action at this time.
0 commit comments