From 95ac7390f522217f0a671e4f483bbc7ccd027ebf Mon Sep 17 00:00:00 2001 From: xuyiming Date: Fri, 23 Oct 2020 10:08:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=96=87=E6=A1=A3=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/technical-support/doc/detail.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/pages/technical-support/doc/detail.vue b/src/pages/technical-support/doc/detail.vue index 0365ce5..6085429 100644 --- a/src/pages/technical-support/doc/detail.vue +++ b/src/pages/technical-support/doc/detail.vue @@ -23,6 +23,7 @@
@@ -151,8 +151,22 @@ export default { successCallback(richTextContent); }, clickNav(item) { + let target = document.querySelector(`#${item.id}`); + + this.setScroll(target, this.$refs.docContent); this.curNav = item.id; }, + setScroll(el, parentEl) { + let actualTop = el.offsetTop; + let current = el.offsetParent; + + while (current !== null) { + actualTop += current.offsetTop; + current = current.offsetParent; + } + + parentEl.scrollTop = actualTop - parentEl.offsetTop; + }, }, }; @@ -248,6 +262,7 @@ export default { line-height: 30px; color: #58617a; text-decoration: none; + cursor: pointer; } .nav_content > li.level_1 > a { color: #242c43; -- 2.26.0