You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/11/11 05:05:29 UTC

[echarts-handbook] branch master updated: fix sidenav not scroll

This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/echarts-handbook.git


The following commit(s) were added to refs/heads/master by this push:
     new 698933f  fix sidenav not scroll
698933f is described below

commit 698933fef158e1812ec4b1f5b83d33c2edd3149a
Author: plainheart <yh...@all-my-life.cn>
AuthorDate: Fri Nov 11 13:04:50 2022 +0800

    fix sidenav not scroll
---
 components/partials/Sidebar.vue        | 10 +++-------
 components/partials/SidebarNavItem.vue |  2 +-
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/components/partials/Sidebar.vue b/components/partials/Sidebar.vue
index 7511629..10d0e9e 100644
--- a/components/partials/Sidebar.vue
+++ b/components/partials/Sidebar.vue
@@ -100,13 +100,13 @@ export default Vue.extend({
     }
   },
   watch: {
-    $route(to, from) {
+    $route() {
       this.sidebarOpen = false
     }
   },
 
   mounted() {
-    const $actived = this.$el.querySelector('.actived') as HTMLElement
+    const $actived = this.$el.querySelector('.nav-link.nuxt-link-active') as HTMLElement
     if ($actived) {
       scrollIntoView($actived, {
         time: 0,
@@ -114,11 +114,7 @@ export default Vue.extend({
           top: 0,
           topOffset: 300
         },
-        isScrollable(target) {
-          return (
-            !!target.className && target.className.indexOf('bd-sidebar') >= 0
-          )
-        }
+        validTarget: target => target.className?.indexOf('bd-docs-nav') > -1
       })
     }
     // @ts-ignore
diff --git a/components/partials/SidebarNavItem.vue b/components/partials/SidebarNavItem.vue
index 0c74fab..81b5663 100644
--- a/components/partials/SidebarNavItem.vue
+++ b/components/partials/SidebarNavItem.vue
@@ -66,7 +66,7 @@ export default Vue.extend({
     const path = this.parentPath
       ? this.parentPath + '/' + this.item.dir
       : this.item.dir
-    const isSelfOrChildActived = (this.$route.params.post + '').startsWith(path)
+    const isSelfOrChildActived = (this.$route.params.pathMatch || '').startsWith(path)
     return {
       get path(): string {
         return path


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org