|
@@ -10,7 +10,7 @@
|
|
|
v-for="(nav, index) in navs"
|
|
|
:key="index"
|
|
|
@click="toPage(index, 0)"
|
|
|
- :class="{ 'menu-item-act': curNav.title === nav.title }"
|
|
|
+ :class="{ 'menu-item-act': curMainIndex === index }"
|
|
|
>
|
|
|
<div class="menu-item">
|
|
|
<i :class="['icon', `icon-${nav.type}`]"></i>
|
|
@@ -37,35 +37,32 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="home-navs" :class="{ 'home-navs-tiny': isCollapsed }">
|
|
|
- <div class="nav-top">
|
|
|
+ <div class="home-navs">
|
|
|
+ <div class="nav-head">
|
|
|
<i :class="['icon', `icon-${curNav.type}-gray`]"></i>
|
|
|
<span>{{ curNav.title }}</span>
|
|
|
</div>
|
|
|
- <ul>
|
|
|
+ <ul class="nav-list">
|
|
|
<li
|
|
|
class="nav-item"
|
|
|
- v-for="(nav, index) in curNav.children"
|
|
|
- :key="index"
|
|
|
+ v-for="(nav, subNo) in curNav.children"
|
|
|
+ :key="subNo"
|
|
|
>
|
|
|
<div
|
|
|
:class="[
|
|
|
'nav-item-main',
|
|
|
- { 'nav-item-main-act': curMain === index }
|
|
|
+ { 'nav-item-main-act': curSubIndex === subNo }
|
|
|
]"
|
|
|
- @click="switchNav(nav, index)"
|
|
|
+ @click="switchNav(subNo)"
|
|
|
>
|
|
|
- <span class="nav-item-icon nav-item-icon-left">
|
|
|
- <i :class="nav.icon"></i>
|
|
|
- </span>
|
|
|
<p class="nav-item-cont">{{ nav.title }}</p>
|
|
|
- <span
|
|
|
- class="nav-item-icon nav-item-icon-right"
|
|
|
- v-if="nav.children && nav.children.length"
|
|
|
- >
|
|
|
+ <span class="nav-item-icon nav-item-icon-right">
|
|
|
<i
|
|
|
:class="[
|
|
|
- nav.showList ? 'el-icon-caret-bottom' : 'el-icon-caret-right'
|
|
|
+ 'icon',
|
|
|
+ curSubIndex === subNo
|
|
|
+ ? 'icon-arrow-right-act'
|
|
|
+ : 'icon-arrow-right'
|
|
|
]"
|
|
|
></i>
|
|
|
</span>
|
|
@@ -77,9 +74,9 @@
|
|
|
<div class="home-body" :class="{ 'home-body-big': isCollapsed }">
|
|
|
<div class="home-main">
|
|
|
<div class="home-breadcrumb">
|
|
|
- <el-breadcrumb>
|
|
|
+ <el-breadcrumb separator=">">
|
|
|
<el-breadcrumb-item :to="{ name: 'Home' }">
|
|
|
- <i class="el-icon-s-home" style="margin-top: -4px;"></i>
|
|
|
+ <i class="icon icon-home" style="margin-top: -2px;"></i>
|
|
|
</el-breadcrumb-item>
|
|
|
<el-breadcrumb-item
|
|
|
v-for="(bread, index) in breadcrumbs"
|
|
@@ -89,8 +86,10 @@
|
|
|
</el-breadcrumb>
|
|
|
</div>
|
|
|
|
|
|
- <!-- page-detail -->
|
|
|
- <router-view />
|
|
|
+ <!-- home-view: page detail -->
|
|
|
+ <div class="home-view">
|
|
|
+ <router-view />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -105,9 +104,8 @@ export default {
|
|
|
return {
|
|
|
isCollapsed: false,
|
|
|
navs,
|
|
|
- curNav: navs[0],
|
|
|
- curMain: 0,
|
|
|
- curSub: "",
|
|
|
+ curMainIndex: 0,
|
|
|
+ curSubIndex: 0,
|
|
|
breadcrumbs: []
|
|
|
};
|
|
|
},
|
|
@@ -116,19 +114,18 @@ export default {
|
|
|
this.actCurNav();
|
|
|
}
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ curNav() {
|
|
|
+ return this.navs[this.curMainIndex];
|
|
|
+ }
|
|
|
+ },
|
|
|
mounted() {
|
|
|
this.actCurNav();
|
|
|
},
|
|
|
methods: {
|
|
|
- switchNav(item, mainIndex) {
|
|
|
- if (item.children) {
|
|
|
- item.showList = !item.showList;
|
|
|
- } else {
|
|
|
- this.breadcrumbs = [{ title: item.title, router: item.router }];
|
|
|
- this.curMain = mainIndex;
|
|
|
- this.curSub = "";
|
|
|
- this.$router.push({ name: item.router });
|
|
|
- }
|
|
|
+ switchNav(subNo) {
|
|
|
+ const curSubItem = this.curNav.children[subNo];
|
|
|
+ this.$router.push({ name: curSubItem.router });
|
|
|
},
|
|
|
actCurNav() {
|
|
|
let router = this.$route.name;
|
|
@@ -136,8 +133,8 @@ export default {
|
|
|
if (item.children && item.children.length) {
|
|
|
item.children.forEach((elem, pindex) => {
|
|
|
if (elem.router === router) {
|
|
|
- this.curSub = index + "-" + pindex;
|
|
|
- this.curMain = index;
|
|
|
+ this.curSubIndex = pindex;
|
|
|
+ this.curMainIndex = index;
|
|
|
this.breadcrumbs = [
|
|
|
{ title: item.title, router: item.router },
|
|
|
{ title: elem.title, router: elem.router }
|
|
@@ -146,24 +143,14 @@ export default {
|
|
|
});
|
|
|
} else {
|
|
|
if (item.router === router) {
|
|
|
- this.curMain = index;
|
|
|
+ this.curMainIndex = index;
|
|
|
this.breadcrumbs = [{ title: item.title, router: item.router }];
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- this.navs[this.curMain].showList = true;
|
|
|
},
|
|
|
toPage(mainIndex, subIndex) {
|
|
|
- const item = this.navs[mainIndex];
|
|
|
- const elem = item.children[subIndex];
|
|
|
- this.breadcrumbs = [
|
|
|
- { title: item.title, router: item.router },
|
|
|
- { title: elem.title, router: elem.router }
|
|
|
- ];
|
|
|
- this.curNav = this.navs[mainIndex];
|
|
|
- this.curMain = mainIndex;
|
|
|
- this.curSub = mainIndex + "-" + subIndex;
|
|
|
-
|
|
|
+ const elem = this.navs[mainIndex].children[subIndex];
|
|
|
this.$router.push({
|
|
|
name: elem.router
|
|
|
});
|