|
@@ -2,16 +2,7 @@
|
|
|
<div :class="{'has-logo':showLogo}">
|
|
|
<logo v-if="showLogo" :collapse="isCollapse" />
|
|
|
<el-scrollbar wrap-class="scrollbar-wrapper">
|
|
|
- <el-menu
|
|
|
- :default-active="activeMenu"
|
|
|
- :collapse="isCollapse"
|
|
|
- :background-color="variables.menuBg"
|
|
|
- :text-color="variables.menuText"
|
|
|
- :unique-opened="false"
|
|
|
- :active-text-color="variables.menuActiveText"
|
|
|
- :collapse-transition="false"
|
|
|
- mode="vertical"
|
|
|
- >
|
|
|
+ <el-menu :default-active="activeMenu" :collapse="isCollapse" :background-color="variables.menuBg" :text-color="variables.menuText" :unique-opened="false" :active-text-color="variables.menuActiveText" :collapse-transition="false" mode="vertical">
|
|
|
|
|
|
<sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path" />
|
|
|
</el-menu>
|
|
@@ -20,43 +11,41 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-import Logo from './Logo'
|
|
|
-import SidebarItem from './SidebarItem'
|
|
|
-import variables from '@/styles/variables.scss'
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import Logo from "./Logo";
|
|
|
+import SidebarItem from "./SidebarItem";
|
|
|
+import variables from "@/styles/variables.scss";
|
|
|
|
|
|
export default {
|
|
|
components: { SidebarItem, Logo },
|
|
|
computed: {
|
|
|
- ...mapGetters([
|
|
|
- 'sidebar'
|
|
|
- ]),
|
|
|
+ ...mapGetters(["sidebar"]),
|
|
|
routes() {
|
|
|
// return this.$router.options.routes
|
|
|
// console.log(global.antRouter)
|
|
|
- return this.$router.options.routes.concat(global.antRouter) //把路由concat进去
|
|
|
+ return this.$router.options.routes.concat(global.antRouter); //把路由concat进去
|
|
|
},
|
|
|
activeMenu() {
|
|
|
- console.log(444);
|
|
|
- const route = this.$route
|
|
|
+ // console.log(444);
|
|
|
+ const route = this.$route;
|
|
|
|
|
|
- const { meta, path ,fullUrl} = route
|
|
|
- console.log(route);
|
|
|
+ const { meta, path, fullUrl } = route;
|
|
|
+ // console.log(route);
|
|
|
// if set path, the sidebar will highlight the path you set
|
|
|
if (meta.activeMenu) {
|
|
|
- return meta.activeMenu
|
|
|
+ return meta.activeMenu;
|
|
|
}
|
|
|
- return path
|
|
|
+ return path;
|
|
|
},
|
|
|
showLogo() {
|
|
|
- return this.$store.state.settings.sidebarLogo
|
|
|
+ return this.$store.state.settings.sidebarLogo;
|
|
|
},
|
|
|
variables() {
|
|
|
- return variables
|
|
|
+ return variables;
|
|
|
},
|
|
|
isCollapse() {
|
|
|
- return !this.sidebar.opened
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ return !this.sidebar.opened;
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|