From 3453aa31eb9b8d49c4f8bd6dcaf993da69b436cf Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 21 May 2021 19:21:16 +0800 Subject: [PATCH] =?UTF-8?q?readme=E4=B8=8B=E6=8B=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Main/CoderDepotReadme.jsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/forge/Main/CoderDepotReadme.jsx b/src/forge/Main/CoderDepotReadme.jsx index 563c798fb..e7e9826e3 100644 --- a/src/forge/Main/CoderDepotReadme.jsx +++ b/src/forge/Main/CoderDepotReadme.jsx @@ -10,18 +10,21 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){ useEffect(()=>{ if(readme && readme.content){ - let path = history.location.pathname; - const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) { - const anchor = el.id; - const level = el.tagName.replace("H", ""); - const href = `#${anchor}`; - return { href:`${path}${href}`,text:el.textContent , level:level } - }); - setMenuList(items); setContent(readme.content); } },[readme]) + useEffect(()=>{ + let path = history.location.pathname; + const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) { + const anchor = el.id; + const level = el.tagName.replace("H", ""); + const href = `#${anchor}`; + return { href:`${path}${href}`,text:el.textContent , level:level } + }); + setMenuList(items); + },[content]) + function menu(){ if(menuList && menuList.length > 0){ let hash = history.location.hash;