@mc-markets/ui 1.0.86 → 1.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -141
- package/dist/404.html +22 -22
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts +5 -13
- package/dist/components/Breadcrumb/Breadcrumb.vue.d.ts.map +1 -1
- package/dist/components/Breadcrumb/BreadcrumbSeparator.vue.d.ts +3 -0
- package/dist/components/Breadcrumb/BreadcrumbSeparator.vue.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePicker.vue.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/TabCard/TabCard.vue.d.ts.map +1 -1
- package/dist/components/Tag/Tag.vue.d.ts +2 -0
- package/dist/components/Tag/Tag.vue.d.ts.map +1 -1
- package/dist/index.cjs +1 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +605 -661
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/packages/components/Alert/Alert.vue +139 -139
- package/packages/components/Banner/Banner.vue +299 -299
- package/packages/components/Breadcrumb/Breadcrumb.vue +113 -77
- package/packages/components/Breadcrumb/BreadcrumbSeparator.vue +31 -0
- package/packages/components/Button/Button.vue +17 -17
- package/packages/components/DatePicker/DatePicker.vue +85 -86
- package/packages/components/Dialog/Dialog.vue +61 -61
- package/packages/components/Empty/Empty.vue +74 -74
- package/packages/components/Form/Form.vue +30 -30
- package/packages/components/FormItem/FormItem.vue +19 -19
- package/packages/components/Icon/Icon.vue +210 -210
- package/packages/components/Input/Input.vue +15 -15
- package/packages/components/Message/Message.vue +503 -503
- package/packages/components/NotifiMessage/NotifiMessage.vue +293 -293
- package/packages/components/Notification/Notification.vue +19 -19
- package/packages/components/Option/Option.vue +13 -13
- package/packages/components/OptionGroup/OptionGroup.vue +13 -13
- package/packages/components/Pagination/Pagination.vue +61 -61
- package/packages/components/Radio/Radio.vue +67 -67
- package/packages/components/RadioButton/RadioButton.vue +110 -110
- package/packages/components/RadioGroup/RadioGroup.vue +155 -155
- package/packages/components/Select/Select.vue +22 -22
- package/packages/components/Switch/Switch.vue +47 -47
- package/packages/components/TabCard/TabCard.vue +107 -177
- package/packages/components/TabCard/TabCardItem.vue +105 -102
- package/packages/components/Table/Table.vue +17 -17
- package/packages/components/Table/TableColumn.vue +20 -20
- package/packages/components/Tabs/TabPane.vue +79 -79
- package/packages/components/Tabs/Tabs.vue +267 -267
- package/packages/components/Tag/Tag.vue +211 -164
- package/packages/components/Tooltip/Tooltip.vue +58 -58
- package/packages/hooks/useClassName.js +23 -23
- package/packages/styles/README.md +129 -129
- package/packages/styles/components/button.scss +121 -121
- package/packages/styles/components/checkbox.scss +18 -18
- package/packages/styles/components/dialog.scss +47 -47
- package/packages/styles/components/form.scss +18 -18
- package/packages/styles/components/input.scss +14 -14
- package/packages/styles/components/select.scss +62 -60
- package/packages/styles/components/table.scss +37 -37
- package/packages/styles/components/tabs.scss +76 -76
- package/packages/styles/components/tag.scss +142 -142
- package/packages/styles/font/iconfont.scss +363 -363
- package/packages/styles/index.scss +94 -94
- package/packages/styles/variables/border-mode.css +6 -6
- package/packages/styles/variables/color-modes-dark.css +143 -143
- package/packages/styles/variables/index.scss +5 -5
- package/packages/styles/variables/primitives-style.css +112 -112
- package/packages/styles/variables/radius-mode.css +14 -14
- package/packages/styles/variables/spacing-mode.css +20 -20
- package/packages/styles/variables/typography-desktop.css +40 -40
- package/packages/styles/variables/typography-mobile.css +40 -40
- package/packages/utils/classNames.js +23 -23
- package/packages/utils/styleUtils.js +105 -105
- package/dist/components/Breadcrumb/BreadcrumbItem.vue.d.ts +0 -17
- package/dist/components/Breadcrumb/BreadcrumbItem.vue.d.ts.map +0 -1
- package/packages/components/Breadcrumb/BreadcrumbItem.vue +0 -142
|
@@ -1,165 +1,212 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tag v-bind="$attrs" class="m-tag" :class="{ 'is-loading':
|
|
3
|
-
<template v-for="(_, name) in $slots" :key="name" #[name]>
|
|
4
|
-
<!-- 自定义spinner loading效果 -->
|
|
5
|
-
<div v-if="
|
|
6
|
-
<div class="ldio-spinner">
|
|
7
|
-
<div v-for="i in 8" :key="i"></div>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
<!-- 原有的prefixIcon -->
|
|
11
|
-
<i
|
|
12
|
-
class="prefixIcon"
|
|
13
|
-
:class="['iconfont', computedPrefixIcon]"
|
|
14
|
-
v-else-if="computedPrefixIcon"
|
|
15
|
-
></i>
|
|
16
|
-
<div>
|
|
17
|
-
<slot :name="name" />
|
|
18
|
-
</div>
|
|
19
|
-
<i
|
|
20
|
-
class="suffixIcon"
|
|
21
|
-
:class="['iconfont',
|
|
22
|
-
v-if="
|
|
23
|
-
></i>
|
|
24
|
-
</template>
|
|
25
|
-
</el-tag>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script setup>
|
|
29
|
-
import { computed } from 'vue'
|
|
30
|
-
|
|
31
|
-
defineOptions({
|
|
32
|
-
name: 'MTag'
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
const props = defineProps({
|
|
36
|
-
prefixIcon: {
|
|
37
|
-
type: String,
|
|
38
|
-
default: ''
|
|
39
|
-
},
|
|
40
|
-
suffixIcon: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: ''
|
|
43
|
-
},
|
|
44
|
-
loading: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false
|
|
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
|
-
.prefixIcon {
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<el-tag v-bind="$attrs" :type="computedType" class="m-tag" :class="{ 'is-loading': computedLoading }">
|
|
3
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]>
|
|
4
|
+
<!-- 自定义spinner loading效果 -->
|
|
5
|
+
<div v-if="computedLoading && !computedPrefixIcon" class="custom-spinner">
|
|
6
|
+
<div class="ldio-spinner">
|
|
7
|
+
<div v-for="i in 8" :key="i"></div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
<!-- 原有的prefixIcon -->
|
|
11
|
+
<i
|
|
12
|
+
class="prefixIcon"
|
|
13
|
+
:class="['iconfont', computedPrefixIcon]"
|
|
14
|
+
v-else-if="computedPrefixIcon"
|
|
15
|
+
></i>
|
|
16
|
+
<div>
|
|
17
|
+
<slot :name="name" />
|
|
18
|
+
</div>
|
|
19
|
+
<i
|
|
20
|
+
class="suffixIcon"
|
|
21
|
+
:class="['iconfont', computedSuffixIcon]"
|
|
22
|
+
v-if="computedSuffixIcon"
|
|
23
|
+
></i>
|
|
24
|
+
</template>
|
|
25
|
+
</el-tag>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script setup>
|
|
29
|
+
import { computed } from 'vue'
|
|
30
|
+
|
|
31
|
+
defineOptions({
|
|
32
|
+
name: 'MTag'
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
prefixIcon: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: ''
|
|
39
|
+
},
|
|
40
|
+
suffixIcon: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: ''
|
|
43
|
+
},
|
|
44
|
+
loading: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
status: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: '',
|
|
51
|
+
validator: (value) => {
|
|
52
|
+
return ['', 'success', 'warning', 'danger'].includes(value)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
// 根据status自动设置type颜色
|
|
58
|
+
const computedType = computed(() => {
|
|
59
|
+
if (props.status) {
|
|
60
|
+
// 如果设置了status,自动映射到对应的type
|
|
61
|
+
return props.status
|
|
62
|
+
}
|
|
63
|
+
// 否则使用v-bind传入的type(通过$attrs)
|
|
64
|
+
return undefined
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// 根据status自动设置图标和loading状态
|
|
68
|
+
const computedLoading = computed(() => {
|
|
69
|
+
if (props.status === 'warning') {
|
|
70
|
+
return true
|
|
71
|
+
}
|
|
72
|
+
return props.loading
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const computedPrefixIcon = computed(() => {
|
|
76
|
+
// 如果有显式的prefixIcon,优先使用
|
|
77
|
+
if (props.prefixIcon) {
|
|
78
|
+
return props.prefixIcon
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 根据status自动设置prefixIcon
|
|
82
|
+
if (props.status === 'success') {
|
|
83
|
+
return 'icon-circle-check-filled'
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (props.status === 'danger') {
|
|
87
|
+
return 'icon-lucide_circle-x-filled'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return ''
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
const computedSuffixIcon = computed(() => {
|
|
94
|
+
// 如果有显式的suffixIcon,优先使用
|
|
95
|
+
if (props.suffixIcon) {
|
|
96
|
+
return props.suffixIcon
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return ''
|
|
100
|
+
})
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<style lang="scss">
|
|
104
|
+
.m-tag {
|
|
105
|
+
.prefixIcon,
|
|
106
|
+
.suffixIcon {
|
|
107
|
+
font-size: 16px;
|
|
108
|
+
display: inline-block;
|
|
109
|
+
line-height: 1;
|
|
110
|
+
|
|
111
|
+
&.iconfont {
|
|
112
|
+
font-family: "iconfont" !important;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&.colorfont {
|
|
116
|
+
font-family: "colorfont" !important;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
.el-tag__content{
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.prefixIcon {
|
|
125
|
+
margin-right: 4px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.suffixIcon {
|
|
129
|
+
margin-left: 4px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// 自定义spinner样式
|
|
133
|
+
.custom-spinner {
|
|
134
|
+
display: inline-block;
|
|
135
|
+
margin-right: 4px;
|
|
136
|
+
width: 16px;
|
|
137
|
+
height: 16px;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
|
|
140
|
+
.ldio-spinner {
|
|
141
|
+
width: 100%;
|
|
142
|
+
height: 100%;
|
|
143
|
+
position: relative;
|
|
144
|
+
transform: translateZ(0) scale(0.16);
|
|
145
|
+
backface-visibility: hidden;
|
|
146
|
+
transform-origin: 0 0;
|
|
147
|
+
|
|
148
|
+
div {
|
|
149
|
+
left: 46px;
|
|
150
|
+
top: 7.5px;
|
|
151
|
+
position: absolute;
|
|
152
|
+
animation: ldio-spinner-fade linear 1s infinite;
|
|
153
|
+
background: currentColor;
|
|
154
|
+
width: 8px;
|
|
155
|
+
height: 21px;
|
|
156
|
+
border-radius: 3.15px / 3.15px;
|
|
157
|
+
transform-origin: 4px 42.5px;
|
|
158
|
+
box-sizing: content-box;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
div:nth-child(1) {
|
|
162
|
+
transform: rotate(0deg);
|
|
163
|
+
animation-delay: -0.875s;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
div:nth-child(2) {
|
|
167
|
+
transform: rotate(45deg);
|
|
168
|
+
animation-delay: -0.75s;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
div:nth-child(3) {
|
|
172
|
+
transform: rotate(90deg);
|
|
173
|
+
animation-delay: -0.625s;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
div:nth-child(4) {
|
|
177
|
+
transform: rotate(135deg);
|
|
178
|
+
animation-delay: -0.5s;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
div:nth-child(5) {
|
|
182
|
+
transform: rotate(180deg);
|
|
183
|
+
animation-delay: -0.375s;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
div:nth-child(6) {
|
|
187
|
+
transform: rotate(225deg);
|
|
188
|
+
animation-delay: -0.25s;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
div:nth-child(7) {
|
|
192
|
+
transform: rotate(270deg);
|
|
193
|
+
animation-delay: -0.125s;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
div:nth-child(8) {
|
|
197
|
+
transform: rotate(315deg);
|
|
198
|
+
animation-delay: 0s;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@keyframes ldio-spinner-fade {
|
|
205
|
+
0% {
|
|
206
|
+
opacity: 1;
|
|
207
|
+
}
|
|
208
|
+
100% {
|
|
209
|
+
opacity: 0;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
165
212
|
</style>
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-tooltip v-bind="mergedAttrs" :popper-class="popperClass">
|
|
3
|
-
<template v-for="(_, name) in $slots" :key="name" #[name]>
|
|
4
|
-
<slot :name="name" />
|
|
5
|
-
</template>
|
|
6
|
-
</el-tooltip>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup>
|
|
10
|
-
import { useClassName } from "@packages/hooks/useClassName.js"
|
|
11
|
-
|
|
12
|
-
defineOptions({
|
|
13
|
-
name: 'MTooltip'
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
// 定义props
|
|
17
|
-
const props = defineProps({
|
|
18
|
-
popperClass: {
|
|
19
|
-
type: String,
|
|
20
|
-
default: ''
|
|
21
|
-
}
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
// 使用类名 Hook
|
|
25
|
-
const { mergedAttrs, className: popperClass } = useClassName('mc-tooltip-popper')
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<style lang="scss">
|
|
29
|
-
.mc-tooltip-popper {
|
|
30
|
-
&.is-dark {
|
|
31
|
-
color: #fff !important;
|
|
32
|
-
background-color: var(--all-gray-6) !important;
|
|
33
|
-
border-color: var(--all-gray-6) !important;
|
|
34
|
-
.el-popper__arrow::before{
|
|
35
|
-
background-color: var(--all-gray-6) !important;
|
|
36
|
-
border-color: var(--all-gray-6) !important;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&.is-light {
|
|
41
|
-
color: #606266 !important;
|
|
42
|
-
background-color: #fff !important;
|
|
43
|
-
border: 1px solid #e4e7ed !important;
|
|
44
|
-
|
|
45
|
-
.el-popper__arrow::before {
|
|
46
|
-
background-color: #fff !important;
|
|
47
|
-
border-color: #fff !important;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
:deep(.el-popper) {
|
|
53
|
-
&.is-light {
|
|
54
|
-
background: var(--bg-tertiary-hover);
|
|
55
|
-
border-color: var(--border-primary);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<el-tooltip v-bind="mergedAttrs" :popper-class="popperClass">
|
|
3
|
+
<template v-for="(_, name) in $slots" :key="name" #[name]>
|
|
4
|
+
<slot :name="name" />
|
|
5
|
+
</template>
|
|
6
|
+
</el-tooltip>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
import { useClassName } from "@packages/hooks/useClassName.js"
|
|
11
|
+
|
|
12
|
+
defineOptions({
|
|
13
|
+
name: 'MTooltip'
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
// 定义props
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
popperClass: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ''
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// 使用类名 Hook
|
|
25
|
+
const { mergedAttrs, className: popperClass } = useClassName('mc-tooltip-popper')
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style lang="scss">
|
|
29
|
+
.mc-tooltip-popper {
|
|
30
|
+
&.is-dark {
|
|
31
|
+
color: #fff !important;
|
|
32
|
+
background-color: var(--all-gray-6) !important;
|
|
33
|
+
border-color: var(--all-gray-6) !important;
|
|
34
|
+
.el-popper__arrow::before{
|
|
35
|
+
background-color: var(--all-gray-6) !important;
|
|
36
|
+
border-color: var(--all-gray-6) !important;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.is-light {
|
|
41
|
+
color: #606266 !important;
|
|
42
|
+
background-color: #fff !important;
|
|
43
|
+
border: 1px solid #e4e7ed !important;
|
|
44
|
+
|
|
45
|
+
.el-popper__arrow::before {
|
|
46
|
+
background-color: #fff !important;
|
|
47
|
+
border-color: #fff !important;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:deep(.el-popper) {
|
|
53
|
+
&.is-light {
|
|
54
|
+
background: var(--bg-tertiary-hover);
|
|
55
|
+
border-color: var(--border-primary);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</style>
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { computed, useAttrs } from 'vue'
|
|
2
|
-
import { classNames, excludeAttrs } from '@packages/utils/classNames.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 类名 Hook
|
|
6
|
-
* @param {string} defaultClass - 默认的类名
|
|
7
|
-
* @param {string} excludeKey - 要排除的属性名,默认为 'popperClass'
|
|
8
|
-
* @returns {Object} 包含 mergedAttrs 和 className 的对象
|
|
9
|
-
*/
|
|
10
|
-
export function useClassName(defaultClass, excludeKey = 'popperClass') {
|
|
11
|
-
const attrs = useAttrs()
|
|
12
|
-
|
|
13
|
-
// 排除指定属性
|
|
14
|
-
const mergedAttrs = computed(() => excludeAttrs(attrs, excludeKey))
|
|
15
|
-
|
|
16
|
-
// 计算类名
|
|
17
|
-
const className = computed(() => classNames(defaultClass, attrs[excludeKey]))
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
mergedAttrs,
|
|
21
|
-
className
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
import { computed, useAttrs } from 'vue'
|
|
2
|
+
import { classNames, excludeAttrs } from '@packages/utils/classNames.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 类名 Hook
|
|
6
|
+
* @param {string} defaultClass - 默认的类名
|
|
7
|
+
* @param {string} excludeKey - 要排除的属性名,默认为 'popperClass'
|
|
8
|
+
* @returns {Object} 包含 mergedAttrs 和 className 的对象
|
|
9
|
+
*/
|
|
10
|
+
export function useClassName(defaultClass, excludeKey = 'popperClass') {
|
|
11
|
+
const attrs = useAttrs()
|
|
12
|
+
|
|
13
|
+
// 排除指定属性
|
|
14
|
+
const mergedAttrs = computed(() => excludeAttrs(attrs, excludeKey))
|
|
15
|
+
|
|
16
|
+
// 计算类名
|
|
17
|
+
const className = computed(() => classNames(defaultClass, attrs[excludeKey]))
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
mergedAttrs,
|
|
21
|
+
className
|
|
22
|
+
}
|
|
23
|
+
}
|