File tree Expand file tree Collapse file tree 5 files changed +43
-15
lines changed Expand file tree Collapse file tree 5 files changed +43
-15
lines changed Original file line number Diff line number Diff line change 11<template >
22 <Header />
3- <div v-if =" headers.length" class =" toc-affix" :style =" y > 60 ? 'position:fixed; top: 16px;' : ''" >
3+ <div v-if =" headers.length" class =" toc-affix" :style =" y > 102 ? 'position:fixed; top: 16px;' : ''" >
44 <a-anchor style =" width : 160px " :items =" headers" >
55 <template #customTitle =" item " >
66 <LinkOutlined v-if =" item.target" />
Original file line number Diff line number Diff line change 1919
2020.main-wrapper {
2121 position : relative ;
22- padding : 40 px 0 0 ;
22+ padding : 0 ;
2323 background : var (--component-background );
2424}
2525
2626.main-container {
2727 position : relative ;
2828 min-height : 500px ;
29- padding : 0 170px 32px 64px ;
29+ padding : 40 px 170px 32px 64px ;
3030 background : var (--component-background );
3131
3232 .ant-row-rtl & {
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ ul.toc > li {
6969
7070.toc-affix {
7171 position : absolute ;
72- top : 80 px ;
72+ top : 118 px ;
7373 right : 0px ;
7474 width : 160px ;
7575 padding : 8px 8px 8px 4px ;
Original file line number Diff line number Diff line change 2323 box-shadow : var (--shadow-2 );
2424 }
2525 }
26+
27+ &-affix {
28+ transition : all 0.25s ;
29+ }
30+
31+ &-affixed {
32+ padding : 12px ;
33+ margin : -8px ;
34+ border-radius : 6px ;
35+ border : 1px solid var (--border-color-base );
36+ background-color : var (--body-background );
37+ }
2638}
2739
2840.components-overview-search {
Original file line number Diff line number Diff line change 1212 </p >
1313 </section >
1414 <a-divider ></a-divider >
15- <a-input
16- ref =" inputRef"
17- v-model:value =" search"
18- :placeholder =" $t('app.components.overview.search')"
19- class =" components-overview-search"
20- auto-focus
21- >
22- <template #suffix >
23- <SearchOutlined />
24- </template >
25- </a-input >
15+ <a-affix :offset-top =" 32" @change =" handleAffixChange" >
16+ <div
17+ class =" components-overview-affix"
18+ :class =" { 'components-overview-affixed': searchBarAffixed }"
19+ >
20+ <a-input
21+ ref =" inputRef"
22+ v-model:value =" search"
23+ :placeholder =" $t('app.components.overview.search')"
24+ class =" components-overview-search"
25+ auto-focus
26+ :style =" { fontSize: searchBarAffixed ? '18px' : '' }"
27+ >
28+ <template #suffix >
29+ <SearchOutlined />
30+ </template >
31+ </a-input >
32+ </div >
33+ </a-affix >
2634 <a-divider ></a-divider >
2735 <template v-for =" group in menuItems " :key =" group .title " >
2836 <div class =" components-overview" >
@@ -84,6 +92,12 @@ export default defineComponent({
8492 const search = ref (' ' );
8593 const inputRef = ref ();
8694 const { dataSource } = useMenus ();
95+
96+ const searchBarAffixed = ref (false );
97+ function handleAffixChange(affixed ? : boolean ) {
98+ searchBarAffixed .value = affixed ;
99+ }
100+
87101 const menuItems = computed (() => {
88102 return [
89103 {
@@ -144,6 +158,8 @@ export default defineComponent({
144158 inputRef ,
145159 isZhCN: globalConfig ?.isZhCN ,
146160 isDark ,
161+ searchBarAffixed ,
162+ handleAffixChange ,
147163 };
148164 },
149165});
You can’t perform that action at this time.
0 commit comments