@@ -27,7 +27,8 @@ function iframeOnload(host) {
27
27
const iframeEl = host . shadowRoot . getElementById ( '__iframe__' ) ;
28
28
clearTimeout ( timer ) ;
29
29
timer = setTimeout ( ( ) => {
30
- iframeEl && ( iframeEl . style = `
30
+ iframeEl &&
31
+ ( iframeEl . style = `
31
32
max-height: 280px;
32
33
transition: max-height .25s .2s var(--anim-time-fn-easing);
33
34
-webkit-transition: max-height .25s .2s var(--anim-time-fn-easing);
@@ -47,7 +48,7 @@ export default define({
47
48
} ,
48
49
observe : ( host ) => {
49
50
clearTimeout ( observeTimer ) ;
50
- const themeMode = document . documentElement . getAttribute ( 'theme-mode ') || 'light' ;
51
+ const themeMode = localStorage . getItem ( '--tdesign-theme ') || 'light' ;
51
52
observeTimer = setTimeout ( ( ) => {
52
53
handleModeChange ( themeMode , host ) ;
53
54
} , 600 ) ;
@@ -65,7 +66,7 @@ export default define({
65
66
titleElement . id = '__td_doc_title__' ;
66
67
titleElement . innerText = value . title ;
67
68
host . appendChild ( titleElement ) ;
68
- }
69
+ } ,
69
70
} ,
70
71
fixedTitle : {
71
72
get : ( _host , lastValue ) => lastValue || undefined ,
@@ -90,28 +91,40 @@ export default define({
90
91
if ( scrollTop >= 228 ) {
91
92
if ( title . style . position !== 'fixed' ) {
92
93
Object . assign ( title . style , {
93
- position : 'fixed' , top : tabs ? '16px' : '28px' , fontSize : '24px' , lineHeight : '32px' , opacity : 1 , visibility : 'visible' ,
94
+ position : 'fixed' ,
95
+ top : tabs ? '16px' : '28px' ,
96
+ fontSize : '24px' ,
97
+ lineHeight : '32px' ,
98
+ opacity : 1 ,
99
+ visibility : 'visible' ,
94
100
} ) ;
95
101
Object . assign ( background . style , { position : 'fixed' , top : '0' , left : asideWidth } ) ;
96
- tabs && Object . assign ( tabs . style , {
97
- position : 'fixed' , top : '64px' , zIndex : 500 ,
98
- } ) ;
102
+ tabs &&
103
+ Object . assign ( tabs . style , {
104
+ position : 'fixed' ,
105
+ top : '64px' ,
106
+ zIndex : 500 ,
107
+ } ) ;
99
108
Object . assign ( issue . style , { position : 'fixed' , top : '24px' , right : '24px' } ) ;
100
109
}
101
110
} else if ( scrollTop > 192 && scrollTop < 228 ) {
102
111
if ( title . style . visibility !== 'hidden' ) {
103
112
Object . assign ( title . style , { opacity : 0 , visibility : 'hidden' } ) ;
104
113
Object . assign ( thumb . style , { opacity : 0 , visibility : 'hidden' } ) ;
105
114
Object . assign ( describe . style , { opacity : 0 , visibility : 'hidden' } ) ;
106
-
115
+
107
116
Object . assign ( background . style , { position : 'absolute' , top : 'unset' , left : '0' } ) ;
108
117
tabs && Object . assign ( tabs . style , { position : 'absolute' , top : '228px' } ) ;
109
118
Object . assign ( issue . style , { position : 'absolute' , top : 'calc(100% - 48px - 12px)' } ) ;
110
119
}
111
120
} else {
112
121
if ( title . style . position === 'fixed' || title . style . visibility === 'hidden' ) {
113
122
Object . assign ( title . style , {
114
- position : 'unset' , fontSize : '48px' , lineHeight : '56px' , opacity : 1 , visibility : 'visible' ,
123
+ position : 'unset' ,
124
+ fontSize : '48px' ,
125
+ lineHeight : '56px' ,
126
+ opacity : 1 ,
127
+ visibility : 'visible' ,
115
128
} ) ;
116
129
Object . assign ( describe . style , { opacity : 1 , visibility : 'visible' } ) ;
117
130
Object . assign ( background . style , { position : 'absolute' , top : 'unset' , left : '0' } ) ;
@@ -133,25 +146,24 @@ export default define({
133
146
const splineUrl = splineConfig [ spline ] ;
134
147
135
148
return html `
136
- ${ splineUrl ? html `
137
- < iframe id ="__iframe__ "
138
- class ="TDesign-doc-header__thumb "
139
- onload ="${ iframeOnload } "
140
- > </ iframe > ` : html ``
141
- }
149
+ ${ splineUrl
150
+ ? html ` < iframe id ="__iframe__ " class ="TDesign-doc-header__thumb " onload ="${ iframeOnload } "> </ iframe > `
151
+ : html `` }
142
152
< div class ="TDesign-doc-header " style ="${ mobileBodyStyle } ">
143
153
< div class ="TDesign-doc-header__inner ">
144
154
< div class ="TDesign-doc-header__badge ">
145
155
< slot name ="badge "> </ slot >
146
156
</ div >
147
157
< div class ="TDesign-doc-header__content ">
148
158
< div class ="TDesign-doc-header__info ">
149
- ${ docInfo ? html `
150
- < h1 class ="TDesign-doc-header__info-title "> ${ docInfo . title } </ h1 >
151
- < div class ="TDesign-doc-header__info-describe ">
152
- < div innerHTML ="${ docInfo . desc } "> </ div >
153
- </ div >
154
- ` : html `` }
159
+ ${ docInfo
160
+ ? html `
161
+ < h1 class ="TDesign-doc-header__info-title "> ${ docInfo . title } </ h1 >
162
+ < div class ="TDesign-doc-header__info-describe ">
163
+ < div innerHTML ="${ docInfo . desc } "> </ div >
164
+ </ div >
165
+ `
166
+ : html `` }
155
167
</ div >
156
168
</ div >
157
169
</ div >
0 commit comments