|
@@ -1,28 +1,91 @@
|
|
|
<template>
|
|
|
<div class="sign_box">
|
|
|
- <div class="sign_item" v-for="item in 4" @click="indexs = item">
|
|
|
- <img src="@/assets/images/pic_tabbg@2x.png" v-show="indexs==item" alt="" class="img">
|
|
|
- <img src="@/assets/404_images/404_cloud.png" alt="" class="icon">
|
|
|
- <span>首页</span>
|
|
|
+ <div class="sign_item" v-for="item in this.sidebarRouters.filter(res => {
|
|
|
+ return res.hidden == false || res.redirect == 'index'
|
|
|
+ })"
|
|
|
+ @click="tabBtn(item)">
|
|
|
+ <img src="@/assets/images/pic_tabbg@2x.png" draggable="false" v-show="activeMenu.includes((item.path||item.redirect))"
|
|
|
+ alt="" class="img">
|
|
|
+ <item v-if="item.meta" :icon="item.meta && item.meta.icon" :title="item.meta.title" />
|
|
|
+ <item v-if="!item.meta" :icon="item.meta && item.meta.icon" :title="'首页'" />
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- export default{
|
|
|
+ import {
|
|
|
+ mapGetters,
|
|
|
+ mapState
|
|
|
+ } from "vuex";
|
|
|
+ import Item from '@/layout/components/Sidebar/Item'
|
|
|
+
|
|
|
+ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- indexs:1
|
|
|
+ indexs: 1,
|
|
|
+ newArr: [],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ Item
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["sidebarRouters", "sidebar", "tabIndex"]),
|
|
|
+ activeMenu() {
|
|
|
+ // const route = this.$route;
|
|
|
+ // const { meta, path } = route;
|
|
|
+ // // if set path, the sidebar will highlight the path you set
|
|
|
+ // if (meta.activeMenu) {
|
|
|
+ // return meta.activeMenu;
|
|
|
+ // }
|
|
|
+ console.log(this.tabIndex, 887)
|
|
|
+ return this.tabIndex;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.init()
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ tabBtn(item) {
|
|
|
+ if(this.activeMenu.includes((item.path||item.redirect))){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (item.redirect == 'index') {
|
|
|
+ if(this.$route.path!=='/index'){
|
|
|
+ this.$router.push({
|
|
|
+ path: '/index'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.$store.dispatch('TabFn', item.redirect)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$store.dispatch('TabFn', item.path)
|
|
|
+ },
|
|
|
+ init() {
|
|
|
+ const route = this.$route;
|
|
|
+ const {
|
|
|
+ meta,
|
|
|
+ path
|
|
|
+ } = route;
|
|
|
+ // if set path, the sidebar will highlight the path you set
|
|
|
+ console.log(route)
|
|
|
+ if (meta.activeMenu) {
|
|
|
+ this.$store.dispatch('TabFn', meta.activeMenu)
|
|
|
+ }
|
|
|
+ this.$store.dispatch('TabFn', path)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .sign_box{
|
|
|
+ .sign_box {
|
|
|
padding-left: 52px;
|
|
|
- .sign_item{
|
|
|
+
|
|
|
+ .sign_item {
|
|
|
cursor: pointer;
|
|
|
float: left;
|
|
|
display: flex;
|
|
@@ -33,25 +96,36 @@
|
|
|
width: 153px;
|
|
|
padding-top: 10px;
|
|
|
box-sizing: border-box;
|
|
|
- .img{
|
|
|
+ color: #fff;
|
|
|
+
|
|
|
+ .img {
|
|
|
width: 153px;
|
|
|
height: 48px;
|
|
|
position: absolute;
|
|
|
left: 0;
|
|
|
bottom: 0;
|
|
|
}
|
|
|
- .icon{
|
|
|
+
|
|
|
+ .icon {
|
|
|
position: relative;
|
|
|
z-index: 1;
|
|
|
width: 20px;
|
|
|
height: 20px;
|
|
|
margin-right: 8px;
|
|
|
}
|
|
|
- span{
|
|
|
+
|
|
|
+ span {
|
|
|
position: relative;
|
|
|
z-index: 1;
|
|
|
- color: #fff;
|
|
|
- font-size: 17px;
|
|
|
+ color: #fff !important;
|
|
|
+ font-size: 17px !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ svg {
|
|
|
+ color: #fff !important;
|
|
|
+ z-index: 2;
|
|
|
+ line-height: 1;
|
|
|
+ margin-right: 5px;
|
|
|
}
|
|
|
}
|
|
|
}
|