tangjinzhou 6 years ago
parent
commit
4033894fd2
1 changed files with 29 additions and 0 deletions
  1. 29 0
      src/layouts/SubMenu.vue

+ 29 - 0
src/layouts/SubMenu.vue

@@ -0,0 +1,29 @@
+<template functional>
+  <a-sub-menu :key="props.menuInfo.path">
+    <span slot="title">
+      <a-icon
+        v-if="props.menuInfo.meta.icon"
+        :type="props.menuInfo.meta.icon"
+      /><span>{{ props.menuInfo.meta.title }}</span>
+    </span>
+    <template v-for="item in props.menuInfo.children">
+      <a-menu-item
+        v-if="!item.children"
+        :key="item.path"
+        @click="
+          () =>
+            parent.$router.push({ path: item.path, query: parent.$route.query })
+        "
+      >
+        <a-icon v-if="item.meta.icon" :type="item.meta.icon" />
+        <span>{{ item.meta.title }}</span>
+      </a-menu-item>
+      <sub-menu v-else :key="item.path" :menu-info="item" />
+    </template>
+  </a-sub-menu>
+</template>
+<script>
+export default {
+  props: ["menuInfo"]
+};
+</script>