|
@@ -0,0 +1,44 @@
|
|
|
|
+<template>
|
|
|
|
+ <el-tabs type="card" closable v-model="activedTab">
|
|
|
|
+ <el-tab-pane
|
|
|
|
+ :key="item.name"
|
|
|
|
+ v-for="item in tabs"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :name="item.name"
|
|
|
|
+ >
|
|
|
|
+ </el-tab-pane>
|
|
|
|
+ </el-tabs>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { mapState, mapMutations } from 'vuex';
|
|
|
|
+export default {
|
|
|
|
+ name: 'TabView',
|
|
|
|
+ computed: {
|
|
|
|
+ activedTab: {
|
|
|
|
+ // this.activedTab
|
|
|
|
+ get() {
|
|
|
|
+ return this.$store.state.system.activedTabValue;
|
|
|
|
+ }, // 读取计算属性时 执行
|
|
|
|
+ // this.activedTab = '2'
|
|
|
|
+ set(tabName) {
|
|
|
|
+ this.setActivedTab(tabName);
|
|
|
|
+ }, // 修改计算属性时 执行
|
|
|
|
+ },
|
|
|
|
+ ...mapState('system', ['tabs']),
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ ...mapMutations('system', ['setActivedTab', 'deleteTab']),
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.el-tabs ::v-deep .el-tabs__header {
|
|
|
|
+ margin: 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.el-tabs--card ::v-deep .el-tabs__header .el-tabs__item.is-active {
|
|
|
|
+ border-bottom-color: #e4e7ed;
|
|
|
|
+}
|
|
|
|
+</style>
|