Эх сурвалжийг харах

[doc]更新布局和页面组件,新增根据URL参数显示赞赏弹窗的功能,并优化底部信息链接的样式和间距。

dufu1991 1 жил өмнө
parent
commit
c06b288938

+ 13 - 0
docs/site/src/routes/+layout.svelte

@@ -7,6 +7,7 @@
 	import { page } from '$app/stores';
 	import { isCmdKStore, isShowFundStore } from '../store.js';
 	import '../app.css';
+	import { delParamsUrl } from '../utils/index.js';
 
 	let { children } = $props();
 
@@ -78,6 +79,18 @@
 		}
 	}
 	const isZh = localStorage.getItem('lang') === 'zh_CN';
+
+	// 根据 params 判断当前 URL 是否含有 fund 参数,如果有则显示赞赏弹窗
+	const urlFund = window.location.href.split('?')[1];
+	const urlParams = new URLSearchParams(urlFund);
+	const isFund = urlParams.has('fund');
+	if (isFund) {
+		isShowFundStore.set(true);
+		// 去除 URL 中的 fund 参数
+		setTimeout(() => {
+			window.history.replaceState({}, '', delParamsUrl(window.location.href, 'fund'));
+		}, 10);
+	}
 </script>
 
 <svelte:head>

+ 10 - 2
docs/site/src/routes/+page.svelte

@@ -156,6 +156,12 @@
 					link: 'https://www.npmjs.com/package/rollup-plugin-stdf-icon',
 					_blank: true
 				},
+				{
+					title: 'rollup-plugin-md-ts',
+					title_en: 'rollup-plugin-md-ts',
+					link: 'https://www.npmjs.com/package/rollup-plugin-md-ts',
+					_blank: true
+				},
 				{
 					title: 'STDF for VS Code',
 					title_en: 'STDF for VS Code',
@@ -584,9 +590,11 @@
 	{#each bottomInfo as item}
 		<div>
 			<div class="mb-2 text-lg font-bold">{isZh ? item.title : item.title_en}</div>
-			<div class="flex flex-col gap-1">
+			<div class="flex flex-col gap-2">
 				{#each item.list as i}
-					<a href={i.link} target={i._blank ? '_blank' : '_self'} title={i.link} class="text-sm">{isZh ? i.title : i.title_en}</a>
+					<a href={i.link} target={i._blank ? '_blank' : '_self'} title={i.link} class="text-sm hover:underline"
+						>{isZh ? i.title : i.title_en}</a
+					>
 				{/each}
 			</div>
 		</div>