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

[incubator-echarts-handbook] branch master updated: fix type errors

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

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


The following commit(s) were added to refs/heads/master by this push:
     new c202976  fix type errors
c202976 is described below

commit c202976184851a194b73e6407314bc8804792e8e
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Nov 25 13:08:49 2020 +0800

    fix type errors
---
 components/partials/Navbar.vue         |  5 +++--
 components/partials/Sidebar.vue        |  7 ++++---
 components/partials/SidebarNavItem.vue | 34 ++++++++++++++++++++++++++--------
 3 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/components/partials/Navbar.vue b/components/partials/Navbar.vue
index 48e662b..cb988b0 100644
--- a/components/partials/Navbar.vue
+++ b/components/partials/Navbar.vue
@@ -5,8 +5,9 @@
 <script lang="ts">
 import zhNav from './Navbar/zh';
 import enNav from './Navbar/zh';
+import Vue from 'vue';
 
-export default {
+export default Vue.extend({
   components: {
 
   },
@@ -17,6 +18,6 @@ export default {
         : enNav;
     }
   }
-};
+});
 
 </script>
diff --git a/components/partials/Sidebar.vue b/components/partials/Sidebar.vue
index 9bd6cc9..5249e33 100644
--- a/components/partials/Sidebar.vue
+++ b/components/partials/Sidebar.vue
@@ -31,10 +31,11 @@
 
 <script lang="ts">
 
-import SidebarNavItem from './SidebarNavItem';
+import Vue from 'vue';
+import SidebarNavItem from './SidebarNavItem.vue';
 import scrollIntoView from 'scroll-into-view';
 
-export default {
+export default Vue.extend({
 
   components: {
     SidebarNavItem
@@ -59,7 +60,7 @@ export default {
       }
     }, 0);
   }
-};
+});
 
 </script>
 
diff --git a/components/partials/SidebarNavItem.vue b/components/partials/SidebarNavItem.vue
index 27fc3fc..a250064 100644
--- a/components/partials/SidebarNavItem.vue
+++ b/components/partials/SidebarNavItem.vue
@@ -27,6 +27,7 @@
       :parentPath="path"
       :item="child"
       :level="level + 1"
+      :key="child.dir"
     ></SidebarNavItem>
   </ul>
 </li>
@@ -34,19 +35,36 @@
 
 
 <script lang="ts">
-export default {
+
+import Vue from 'vue';
+
+interface NavItem {
+  dir: string
+}
+
+export default Vue.extend({
 
   name: 'SidebarNavItem',
 
-  props: ['item', 'parentPath', 'level'],
+  props: {
+    item: {
+      type: Object as () => NavItem
+    },
+    parentPath: {
+      type: String as () => string
+    },
+    level: {
+      type: Number as () => number
+    }
+  },
 
   computed: {
-    link() {
+    link(): string {
       return this.$store.state.config.rootPath + '/' + this.$store.state.locale
         + '/' + this.path;
     },
 
-    isActived() {
+    isActived(): boolean {
       return this.$route.params.post === this.path;
     }
   },
@@ -55,11 +73,11 @@ export default {
     const path = this.parentPath + '_' + this.item.dir;
     const isSelfOrChildActived = this.$route.params.post.startsWith(path);
     return {
-      get path() {
+      get path(): string {
         return path;
       },
-      collapsed: this.level >= 2 && !isSelfOrChildActived
-    }
+      collapsed: (this.level >= 2 && !isSelfOrChildActived) as boolean
+    };
   },
 
   methods: {
@@ -67,7 +85,7 @@ export default {
       this.collapsed = !this.collapsed
     }
   }
-}
+});
 </script>
 
 <style lang="scss">


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