1
1
<template >
2
- <n-layout-header class =" header-tab" >
3
- <n-flex justify =" space-between" align =" center" >
2
+ <n-layout-header class =" header-tab relative " >
3
+ <n-space justify =" space-between" align =" center" >
4
4
<n-flex ref =" el" style =" gap : 0 " >
5
5
<n-flex
6
6
justify =" center"
7
7
align =" center"
8
8
v-for =" item in list"
9
- class =" tab-item py-0 px-1.25 "
9
+ class =" tab-item cursor-pointer "
10
10
:key =" item.id"
11
11
:class =" {
12
12
'active-tab': item.isActive,
15
15
}"
16
16
@click =" handleTabClick(item)"
17
17
>
18
- {{ item.name }}
18
+ <n-text class =" px-[10px] flex items-center text-white" >
19
+ <span class =" inline-flex h-[35px] min-w-[85px] text-[13px] justify-center items-center" >
20
+ {{ item.name }}
21
+ </span >
22
+ <n-icon
23
+ v-if =" item.isActive"
24
+ :size =" 14"
25
+ class =" text-white"
26
+ :component =" CloseOutline"
27
+ ></n-icon >
28
+ </n-text >
19
29
</n-flex >
20
30
</n-flex >
21
- <n-flex justify =" space-between" align =" center" class =" operation-item" >
31
+ <!-- todo)) 组件拆分 -->
32
+ <n-flex
33
+ justify =" space-between"
34
+ align =" center"
35
+ class =" h-[35px] mr-[15px]"
36
+ style =" column-gap : 5px "
37
+ >
22
38
<n-popover >
23
39
<template #trigger >
24
- <n-icon size =" 18px" :component =" CopyOutline" />
40
+ <div
41
+ class =" flex justify-center items-center w-[25px] h-[25px] cursor-pointer transition-all duration-300 ease-in-out hover:rounded-[5px] hover:bg-custom-icon-hover-color"
42
+ >
43
+ <svg-icon name =" split" :icon-style =" iconStyle" />
44
+ </div >
25
45
</template >
26
46
拆分
27
47
</n-popover >
28
48
29
49
<n-popover >
30
50
<template #trigger >
31
- <n-icon size =" 18px" :component =" EllipsisHorizontal" />
51
+ <div
52
+ class =" flex justify-center items-center w-[25px] h-[25px] cursor-pointer transition-all duration-300 ease-in-out hover:rounded-[5px] hover:bg-custom-icon-hover-color"
53
+ >
54
+ <n-icon size =" 16px" :component =" EllipsisHorizontal" />
55
+ </div >
32
56
</template >
33
57
操作
34
58
</n-popover >
35
59
</n-flex >
36
- </n-flex >
60
+ <!-- todo)) 组件拆分 -->
61
+ </n-space >
37
62
</n-layout-header >
38
63
</template >
39
64
40
65
<script setup lang="ts">
41
- import { reactive , ref } from ' vue' ;
42
- import { CopyOutline , EllipsisHorizontal } from ' @vicons/ionicons5 ' ;
66
+ import { type CSSProperties , reactive , ref } from ' vue' ;
67
+ import SvgIcon from ' @/components/SvgIcon/index.vue ' ;
43
68
import { useDraggable , type UseDraggableReturn } from ' vue-draggable-plus' ;
69
+ import { EllipsisHorizontal , CloseOutline } from ' @vicons/ionicons5' ;
44
70
45
71
const el = ref ();
46
72
47
73
const list = reactive ([
48
74
{
49
- name: ' Joao ' ,
75
+ name: ' index.js ' ,
50
76
id: 1 ,
51
77
clickCount: 0 ,
52
78
isActive: false
@@ -56,20 +82,16 @@ const list = reactive([
56
82
id: 2 ,
57
83
clickCount: 0 ,
58
84
isActive: false
59
- },
60
- {
61
- name: ' Johanna' ,
62
- id: 3 ,
63
- clickCount: 0 ,
64
- isActive: false
65
- },
66
- {
67
- name: ' Juan' ,
68
- id: 4 ,
69
- clickCount: 0 ,
70
- isActive: false
71
85
}
72
86
]);
87
+
88
+ const iconStyle: CSSProperties = {
89
+ fill: ' #D8D8D8' ,
90
+ width: ' 16px' ,
91
+ height: ' 16px' ,
92
+ transition: ' fill 0.3s'
93
+ };
94
+
73
95
// eslint-disable-next-line @typescript-eslint/no-unused-vars
74
96
const draggable = useDraggable <UseDraggableReturn >(el , list , {
75
97
animation: 150 ,
@@ -96,17 +118,9 @@ const handleTabClick = (item: { id: number }) => {
96
118
97
119
<style scoped lang="scss">
98
120
.header-tab {
99
- position : relative ;
100
121
width : 100% !important ;
101
- height : 35px ;
102
122
background-color : var (--el-main-header-bg-color );
103
123
.tab-item {
104
- display : flex ;
105
- align-items : center ;
106
- justify-content : center ;
107
- width : 60px ;
108
- height : 35px ;
109
- cursor : pointer ;
110
124
transition : all 0.3s ease-in-out ;
111
125
& .first-click {
112
126
font-style : italic ;
@@ -117,24 +131,9 @@ const handleTabClick = (item: { id: number }) => {
117
131
color : rgb (255 255 255 / 50% );
118
132
}
119
133
& .active-tab {
120
- color : #ffffff ;
134
+ color : #ffffff !important ;
121
135
background-color : var (--el-main-bg-color );
122
136
}
123
137
}
124
- .operation-item {
125
- margin-right : 15px ;
126
- .n-icon {
127
- display : flex ;
128
- align-items : center ;
129
- justify-content : center ;
130
- padding : 3px ;
131
- cursor : pointer ;
132
- transition : all 0.3s ease-in-out ;
133
- & :hover {
134
- background-color : #363737 ;
135
- border-radius : 5px ;
136
- }
137
- }
138
- }
139
138
}
140
139
</style >
0 commit comments