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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<template>
<div class="serviceCard">
<a-tabs :activeKey="tabsActive" type="editable-card" hideAdd size="small" :tabBarGutter="6" :tabBarStyle="{padding: '0 52px 0 8px'}" @tabClick="tabclick" @edit="tabClose">
<a-tab-pane :forceRender="true" v-for="(item) in tabsArray" :key="item.key" :tab="item.title" :closable="item.closable">
<a-dropdown style="position: absolute;right: 2px;top: 0" :trigger="['click','']">
<a class="ant-dropdown-link">
<a-icon type="double-right" class="adp-icon" />
</a>
<a-menu slot="overlay">
<a-menu-item :disabled="disabled" @click="operation(1,tabsActive)">关闭当前标签页</a-menu-item>
<a-menu-item @click="operation(2,tabsActive)">关闭其他标签页</a-menu-item>
<a-menu-item @click="operation(3,tabsActive)">关闭全部标签页</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px;transform:rotate(90deg);width:40px;height:37px;border:0" icon="double-right"></a-button>
</a-dropdown>
<!-- <a-dropdown :trigger="['contextmenu']" :value="contextmenuVisible" slot="tab">
<span>
<span>{{ item.title }}</span>
<a-icon type="close" v-if="item.closable" style="margin-left: 8px;margin-right: 0" @click.stop="operation(1,item.key)" />
</span>
</a-dropdown> -->
</a-tab-pane>
</a-tabs>
</div>
</template>
<script>
import { mapMutations } from "vuex";
export default {
name: "ServiceCardList",
data () {
return {
contextmenuVisible: false,
disabled: false, //判断关闭当前页签是否展示
}
},
created () {
},
computed: {
tabsArray: {
get () {
return this.$store.state.app.tabsArray
},
set () {
}
},
tabsActive: {
get () {
return this.$store.state.app.tabsActive
},
set () {
}
},
},
methods: {
...mapMutations(`app`, [`clickCard`, `closeCard`, `optCard`]),
tabclick (key) {
this.clickCard(key)
},
tabClose (key) {
this.closeCard(key)
},
/**
* 页签卡片操作
* @param type 0 点击切换 1 关闭当前页签 2关闭其他标签 3关闭所有标签
* @param key
*/
operation (type, key) {
this.optCard({ key: key, type: type })
},
}
}
</script>
<style scoped lang="less">
.serviceCard {
width: 100%;
::v-deep .ant-tabs .ant-tabs-bar {
height: 36px;
line-height: 34px;
margin: 0 !important;
.ant-tabs-nav-container {
height: 36px;
}
.ant-tabs-nav-container
.ant-tabs-nav-wrap
.ant-tabs-nav-scroll
.ant-tabs-nav {
.ant-tabs-tab {
height: 36px;
line-height: 34px;
margin-right: 4px !important;
}
// .ant-tabs-tab-active {
// background: #0079fe !important;
// color: #fff;
// .ant-tabs-close-x {
// color: #fff;
// }
// }
}
}
.adp-icon {
font-size: 18px;
color: #949494;
-moz-transform: rotate(90deg);
-webkit-transform: rotate(90deg);
margin: 6px 14px 0 0;
}
}
</style>