File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 82
82
<slot v-if =" type === 'TS'" name =" htmlCode" />
83
83
<slot v-else name =" jsVersionHtml" />
84
84
</div >
85
+ <div class =" code-box-actions code-box-actions-bottom" >
86
+ <a-tooltip :title =" $t(`app.demo.code.hide`)" >
87
+ <span class =" code-expand-icon code-box-code-action" >
88
+ <img
89
+ alt =" expand code"
90
+ :src ="
91
+ theme === 'dark'
92
+ ? 'https://gw.alipayobjects.com/zos/antfincdn/CjZPwcKUG3/OpROPHYqWmrMDBFMZtKF.svg'
93
+ : 'https://gw.alipayobjects.com/zos/antfincdn/4zAaozCvUH/unexpand.svg'
94
+ "
95
+ :class =" 'code-expand-icon-show'"
96
+ @click =" handleCodeExpand($event, sectionId)"
97
+ />
98
+ </span >
99
+ </a-tooltip >
100
+ </div >
85
101
</section >
86
102
</section >
87
103
</template >
@@ -164,11 +180,17 @@ export default defineComponent({
164
180
).trim ()
165
181
: ' ' ,
166
182
);
167
- const handleCodeExpand = () => {
183
+ const handleCodeExpand = (_ , sectionId ? ) => {
168
184
if (globalConfig .blocked .value ) {
169
185
warning ();
170
186
return ;
171
187
}
188
+ if (sectionId ) {
189
+ const element = document .getElementById (sectionId );
190
+ if (element ) {
191
+ element .scrollIntoView ();
192
+ }
193
+ }
172
194
codeExpand .value = ! codeExpand .value ;
173
195
};
174
196
const handleCodeCopied = () => {
Original file line number Diff line number Diff line change 2
2
& .rtl {
3
3
direction : rtl ;
4
4
}
5
+ scroll-behavior : smooth ;
5
6
}
6
7
7
8
body {
You can’t perform that action at this time.
0 commit comments