Skip to content

Commit b5eb9e7

Browse files
committed
feat: DictTag组件增加props支持自定义每个tag之间的间隔,默认为5px
1 parent 6edd64f commit b5eb9e7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/components/DictTag/src/DictTag.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export default defineComponent({
2020
sepSymbol: {
2121
type: String as PropType<string>,
2222
default: ','
23+
},
24+
// 每个tag之间的间隔,默认为5px
25+
tagSpacing: {
26+
type: String as PropType<string>,
27+
default: '5px'
2328
}
2429
},
2530
setup(props) {
@@ -49,7 +54,15 @@ export default defineComponent({
4954
const dictOptions = getDictOptions(props.type)
5055
5156
return (
52-
<div class="dict-tag">
57+
<div
58+
class="dict-tag"
59+
style={{
60+
display: 'flex',
61+
gap: props.tagSpacing,
62+
justifyContent: 'center',
63+
alignItems: 'center'
64+
}}
65+
>
5366
{dictOptions.map((dict: DictDataType) => {
5467
if (valueArr.value.includes(dict.value)) {
5568
if (dict.colorType + '' === 'primary' || dict.colorType + '' === 'default') {

0 commit comments

Comments
 (0)