16
16
</div >
17
17
<span class =" docs-header-spacer" ></span >
18
18
</header >
19
- <div class =" docs-content" id =" doc-layout-scoller " >
19
+ <div class =" docs-content" id =" doc-layout-scroller " >
20
20
<div class =" ti-rel cmp-container" >
21
21
<div class =" flex-horizontal docs-content-main" >
22
22
<div class =" docs-tabs-wrap" >
233
233
<div class =" cmp-page-anchor catalog" v-if =" currAnchorLinks.length" >
234
234
<tiny-anchor
235
235
id =" anchor"
236
+ :offset-top =" 56"
236
237
:links =" currAnchorLinks"
237
238
:key =" anchorRefreshKey"
238
239
:is-affix =" anchorAffix"
239
240
type =" dot"
240
- container-id =" #doc-layout-scoller "
241
+ container-id =" #doc-layout-scroller "
241
242
@link-click =" handleAnchorClick"
242
243
>
243
244
</tiny-anchor >
@@ -469,7 +470,7 @@ export default defineComponent({
469
470
const scrollByHash = (hash) => {
470
471
setTimeout(() => {
471
472
if (!hash) {
472
- document.getElementById('doc-layout-scoller ').scrollTo({
473
+ document.getElementById('doc-layout-scroller ').scrollTo({
473
474
top: 0,
474
475
left: 0
475
476
})
@@ -482,10 +483,10 @@ export default defineComponent({
482
483
scrollTarget = document.querySelector(`#${hash}`)
483
484
} catch (err) {}
484
485
if (scrollTarget && !isRunningTest) {
485
- // doc-layout-scoller (滚动) > tabs > tab-content(relative), 造成 scrollTarget.offsetTop 是相对于 tab-content的距离
486
+ // doc-layout-scroller (滚动) > tabs > tab-content(relative), 造成 scrollTarget.offsetTop 是相对于 tab-content的距离
486
487
// 所以滚动需要修正 tab-title的占位高度才行
487
- document.getElementById('doc-layout-scoller ').scrollTo({
488
- top: scrollTarget.offsetTop + 52 ,
488
+ document.getElementById('doc-layout-scroller ').scrollTo({
489
+ top: scrollTarget.offsetTop,
489
490
left: 0,
490
491
behavior: 'smooth'
491
492
})
@@ -499,7 +500,7 @@ export default defineComponent({
499
500
let hash = router.currentRoute.value.hash?.slice(1)
500
501
if (hash !== 'API') {
501
502
setTimeout(() => {
502
- document.getElementById('doc-layout-scoller ').scrollTo({
503
+ document.getElementById('doc-layout-scroller ').scrollTo({
503
504
top: 0,
504
505
left: 0,
505
506
behavior: 'smooth'
@@ -620,26 +621,26 @@ export default defineComponent({
620
621
}
621
622
622
623
const onDocLayoutScroll = debounce(100, false, () => {
623
- const docLayout = document.getElementById('doc-layout-scoller ')
624
+ const docLayout = document.getElementById('doc-layout-scroller ')
624
625
const { scrollTop, scrollHeight, clientHeight: layoutHeight } = docLayout
625
626
const headerHeight = document.querySelector('.docs-header')?.clientHeight || 0
626
627
const footerHeight = document.getElementById('footer')?.clientHeight || 0
627
628
const anchorHeight = document.querySelector('#anchor')?.clientHeight || 0
628
- const remainHeight = scrollHeight - scrollTop - layoutHeight // doc-layout-scoller视口下隐藏的部分高度
629
+ const remainHeight = scrollHeight - scrollTop - layoutHeight // doc-layout-scroller视口下隐藏的部分高度
629
630
state.anchorAffix = layoutHeight - headerHeight - (footerHeight - remainHeight) > anchorHeight
630
631
})
631
632
632
633
const setScrollListener = () => {
633
634
nextTick(() => {
634
- const docLayout = document.getElementById('doc-layout-scoller ')
635
+ const docLayout = document.getElementById('doc-layout-scroller ')
635
636
if (docLayout) {
636
637
docLayout.addEventListener('scroll', onDocLayoutScroll)
637
638
}
638
639
})
639
640
}
640
641
641
642
const removeScrollListener = () => {
642
- const docLayout = document.getElementById('doc-layout-scoller ')
643
+ const docLayout = document.getElementById('doc-layout-scroller ')
643
644
if (docLayout) {
644
645
docLayout.removeEventListener('scroll', onDocLayoutScroll)
645
646
}
@@ -802,7 +803,7 @@ export default defineComponent({
802
803
.docs-content {
803
804
flex : 1 ;
804
805
overflow : hidden auto ;
805
- padding : 16px 0 0 ;
806
+ margin-top : 16px ;
806
807
transition : all ease-in-out 0.3s ;
807
808
808
809
.docs-tabs-wrap {
@@ -826,6 +827,7 @@ export default defineComponent({
826
827
827
828
:deep(> .tiny-tabs__header ) {
828
829
position : sticky ;
830
+ top : 0 ;
829
831
z-index : var (--docs-tabs-header-zindex );
830
832
background-color : #fff ;
831
833
0 commit comments