From 2472c109f73d765c4cda7d9cd10a583cf9ee1cdd Mon Sep 17 00:00:00 2001 From: PJ568 Date: Wed, 11 Dec 2024 15:28:37 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=B4=A2=E5=BC=95=E9=A1=B5=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index a0495c0..a6ed774 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - + @@ -23,6 +23,7 @@ var timer = null; // 文档解析功能相关 + var existIndexPage = true; // 是否存在索引页 var url = new URL(window.location.href); var params = new URLSearchParams(url.search); var pValue = formatPath(params.get('p')); @@ -317,9 +318,14 @@ if (pValue) { await showMarkdown(pValue); } else { - const response = await fetch(getPath() + 'index.md'); - if (response.ok) { - await showMarkdown(getPath() + 'index.md', response); + if (existIndexPage) { + const response = await fetch(getPath() + 'index.md'); + if (response.ok) { + await showMarkdown(getPath() + 'index.md', response); + } else { + existIndexPage = true; + await showMarkdown(getPath() + 'README.md'); + } } else { await showMarkdown(getPath() + 'README.md'); }