|
@@ -0,0 +1,39 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-menu
|
|
|
+ :default-active="$route.path"
|
|
|
+ background-color="#545c64"
|
|
|
+ text-color="#fff"
|
|
|
+ active-text-color="#ffd04b"
|
|
|
+ mode="vertical"
|
|
|
+ router
|
|
|
+ :collapse="true"
|
|
|
+ >
|
|
|
+ <template v-for="(item, index) in routers">
|
|
|
+ <el-menu-item :index="item.path" :key="index">{{item.title}}</el-menu-item>
|
|
|
+ </template>
|
|
|
+ </el-menu>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import Router from "@/router";
|
|
|
+export default {
|
|
|
+ name: "sidebar",
|
|
|
+ data() {
|
|
|
+ return { routers: Router };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ getrouters() {
|
|
|
+ //路由表
|
|
|
+ return Router;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ console.log(Router);
|
|
|
+ this.routers = Router.options.routes;
|
|
|
+ console.log(this.routers);
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style></style>
|