@@ -32,6 +32,7 @@ const changelogVersion = ref('');
3232const selectedVersion = ref (' ' );
3333const availableVersions = ref ([]);
3434const loadingVersions = ref (false );
35+ const scrollContainer = ref (null );
3536
3637// 获取当前版本号(从版本信息中提取)
3738async function getCurrentVersion () {
@@ -104,6 +105,24 @@ function onVersionChange() {
104105 }
105106}
106107
108+ function handleChangelogClick (event ) {
109+ const targetElement = event .target instanceof Element ? event .target : null ;
110+ const anchor = targetElement? .closest (' a[href^="#"]' );
111+ if (! anchor) return ;
112+
113+ const rawHref = anchor .getAttribute (' href' );
114+ const targetId = rawHref ? decodeURIComponent (rawHref .slice (1 )) : ' ' ;
115+ if (! targetId) return ;
116+
117+ const target = scrollContainer .value ? .querySelector (
118+ ` #${ CSS .escape (targetId)} ` ,
119+ );
120+ if (! target) return ;
121+
122+ event .preventDefault ();
123+ target .scrollIntoView ({ behavior: ' smooth' , block: ' start' });
124+ }
125+
107126// 监听对话框打开,初始化数据
108127watch (dialog, async (newValue ) => {
109128 if (newValue) {
@@ -178,7 +197,11 @@ getCurrentVersion();
178197 < / div>
179198
180199 <!-- 更新日志内容 -->
181- < div style= " max-height: 70vh; overflow-y: auto;" >
200+ < div
201+ ref= " scrollContainer"
202+ style= " max-height: 70vh; overflow-y: auto;"
203+ @click= " handleChangelogClick"
204+ >
182205 < div v- if = " changelogLoading" class = " text-center py-8" >
183206 < v- progress- circular indeterminate color= " primary" >< / v- progress- circular>
184207 < div class = " mt-4" > {{ t (' core.navigation.changelogDialog.loading' ) }}< / div>
0 commit comments