Commit ad1480db by 林家欣

新增首页和机构概况路由

parent f0f430bf
This source diff could not be displayed because it is too large. You can view the blob instead.
<template>
<el-menu router :default-active="$route.path">
<template>
<div class="menu-logo">
<!-- <router-link :to="{name:'home'}" class="span"> -->
<span><img src="../../assets/image/icon-menu-logo.png" alt="">链通万家</span>
<!-- </router-link> -->
</div>
<div class="menu-title">常用菜单</div>
<el-menu-item v-for="item in menu" :key="item.meta.name" :index="item.path">
<span>{{item.meta.name}}</span>
<i :class="item.meta.icon"></i>
</el-menu-item>
</template>
</el-menu>
</template>
<script>
import router from "@/router/index.js"
import {
mapState
} from "vuex"
export default {
data() {
return {
collapse: false,
menu: [],
roleId:[],
}
},
computed: {
...mapState({
userMenus: state => state.user.userMenus
})
},
methods: {
routerList(data){
const menuRoutes = data.filter(item => { return item.meta && item.meta.icon })
return menuRoutes.filter(item => {
const isInMenu = this.userMenus.some(auth => { return auth.path === item.path })
return isInMenu
})
}
},
mounted() {
this.menu = this.routerList(router.options.routes)
},
created() {
},
}
</script>
<style>
</style>
<template>
<el-container class="layout">
<el-aside width="180px">
<Sidebar></Sidebar>
</el-aside>
<el-container>
<el-header height="65px">
<Header></Header>
......@@ -10,9 +7,9 @@
<el-main>
<router-view></router-view>
</el-main>
<!-- <el-footer>
<el-footer>
<Footer></Footer>
</el-footer> -->
</el-footer>
</el-container>
</el-container>
</template>
......@@ -20,11 +17,9 @@
<script>
import Header from "./layout/header.vue"
// import Footer from "./layout/footer.vue"
import Sidebar from "./layout/sidebar.vue"
export default {
components: {
Header,
Sidebar
},
data() {
return {
......
......@@ -12,6 +12,28 @@ VueRouter.prototype.push = function push (to) {
const routes = [
{
path: "/Home",
name: "Home",
component: main,
meta: {
name: "首页"
},
children: [
{
path: "/",
component: () => import("@/views/Home/index")
},
{
path: "/Org",
name: "Org",
meta: {
name: "机构概况",
},
component: () => import("@/views/Org/index")
}
]
},
{
path: "/",
redirect: "/login"
},
......
<template>
<div></div>
</template>
<div>
</div>
</template>
<script>
export default {
data() {
return {
}
},
created() {
console.log(this.$route, 'this.$route');
},
}
</script>
<style lang="scss" scoped>
<style lang="scss">
</style>
\ No newline at end of file
<template>
<div></div>
<div>
ORG
</div>
</template>
<script>
export default {
data() {
return {
}
},
created() {
console.log(this.$route, 'this.$route');
},
}
</script>
<style lang="scss" scoped>
<style lang="scss">
</style>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment