1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<template>
<div class="page-tab-view">
<el-tabs :value="activeKey" @tab-click="changeRouter">
<el-tab-pane v-for="v in secondaryRoutes" :key="v.path" :name="v.path">
<template slot="label">
<i v-if="v.meta.icon" :class="['tab-icon', v.meta.icon]"></i>
<span class="tab-label">{{ v.meta.title }}</span>
</template>
</el-tab-pane>
</el-tabs>
<div class="out-box">
<router-view></router-view>
</div>
</div>
</template>
<script>
import { mapGetters } from "vuex";
export default {
data() {
return {};
},
computed: {
activeKey() {
return this.$route.path;
},
...mapGetters(["secondaryRoutes"]),
},
created() {},
methods: {
changeRouter(e) {
this.$router.push(e.name);
},
},
};
</script>
<style lang="less" scoped>
:deep(.el-tabs__nav-scroll) {
padding-left: 15px;
.tab-icon {
margin-right: 5px;
color: #2681e8;
}
.tab-label {
font-weight: bold;
color: rgba(0, 0, 0, 0.65);
}
.is-active {
.tab-label {
color: #2681e8;
}
}
}
.page-tab-view {
width: 100%;
height: 100%;
background: #fff;
display: flex;
flex-direction: column;
.out-box {
flex: 1;
padding: 15px;
overflow-y: auto;
}
}
</style>