readme下拉
This commit is contained in:
parent
ebf75ed433
commit
3453aa31eb
|
@ -10,18 +10,21 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
if(readme && readme.content){
|
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);
|
setContent(readme.content);
|
||||||
}
|
}
|
||||||
},[readme])
|
},[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(){
|
function menu(){
|
||||||
if(menuList && menuList.length > 0){
|
if(menuList && menuList.length > 0){
|
||||||
let hash = history.location.hash;
|
let hash = history.location.hash;
|
||||||
|
|
Loading…
Reference in New Issue