Commit da510826 authored by 张俊's avatar 张俊

Merge branch 'dev' of https://cloud.wodcloud.com/git/apaas/apaas-v3-ui into dev

parents ae34d208 2e855906
...@@ -89,23 +89,23 @@ export default { ...@@ -89,23 +89,23 @@ export default {
level = 1; level = 1;
id = `nav_${pre_h1_index}_${time}`; id = `nav_${pre_h1_index}_${time}`;
newTitle = title.replace(/<h1/g, `<h1 id="${id}"`); newTitle = title.replace("<h1", `<h1 id="${id}"`);
} else if (title.match(/<h2(([\s\S])*?)<\/h2>/g)) { } else if (title.match(/<h2(([\s\S])*?)<\/h2>/g)) {
pre_h2_index++; pre_h2_index++;
pre_h3_index = 0; pre_h3_index = 0;
level = 2; level = 2;
id = `nav_${pre_h1_index}_${pre_h2_index}_${time}`; id = `nav_${pre_h1_index}_${pre_h2_index}_${time}`;
newTitle = title.replace(/<h2/g, `<h2 id="${id}"`); newTitle = title.replace("<h2", `<h2 id="${id}"`);
} else if (title.match(/<h3(([\s\S])*?)<\/h3>/g)) { } else if (title.match(/<h3(([\s\S])*?)<\/h3>/g)) {
pre_h3_index++; pre_h3_index++;
level = 3; level = 3;
id = `nav_${pre_h1_index}_${pre_h2_index}_${pre_h3_index}_${time}`; id = `nav_${pre_h1_index}_${pre_h2_index}_${pre_h3_index}_${time}`;
newTitle = title.replace(/<h3/g, `<h3 id="${id}"`); newTitle = title.replace("<h3", `<h3 id="${id}"`);
} }
content = content.replace(new RegExp(title), newTitle); content = content.replace(title, newTitle);
return { return {
level, level,
...@@ -127,6 +127,10 @@ export default { ...@@ -127,6 +127,10 @@ export default {
this.curNav = item.id; this.curNav = item.id;
}, },
setScroll(el, parentEl) { setScroll(el, parentEl) {
if (!el || !parentEl) {
return;
}
let actualTop = el.offsetTop; let actualTop = el.offsetTop;
let current = el.offsetParent; let current = el.offsetParent;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment