readme下拉

This commit is contained in:
caishi 2021-05-21 19:21:16 +08:00
parent ebf75ed433
commit 3453aa31eb
1 changed files with 11 additions and 8 deletions

View File

@ -10,6 +10,11 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
useEffect(()=>{
if(readme && readme.content){
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;
@ -18,9 +23,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
return { href:`${path}${href}`,text:el.textContent , level:level }
});
setMenuList(items);
setContent(readme.content);
}
},[readme])
},[content])
function menu(){
if(menuList && menuList.length > 0){