Skip to content

Commit de9ec95

Browse files
committed
【代码优化】DictTag 的 render 方法的命名,属性的命名
1 parent f7d31d5 commit de9ec95

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/components/DictTag/src/DictTag.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ export default defineComponent({
1717
required: true
1818
},
1919
// 字符串分隔符 只有当 props.value 传入值为字符串时有效
20-
sepSymbol: {
20+
separator: {
2121
type: String as PropType<string>,
2222
default: ','
2323
},
24-
// 每个tag之间的间隔,默认为5px
25-
tagSpacing: {
24+
// 每个 tag 之间的间隔,默认为 5px,参考的 el-row 的 gutter
25+
gutter: {
2626
type: String as PropType<string>,
2727
default: '5px'
2828
}
@@ -35,15 +35,15 @@ export default defineComponent({
3535
}
3636
// 2.是字符串(进一步判断是否有包含分隔符号 -> props.sepSymbol )
3737
else if (isString(props.value)) {
38-
return props.value.split(props.sepSymbol)
38+
return props.value.split(props.separator)
3939
}
4040
// 3.数组
4141
else if (isArray(props.value)) {
4242
return props.value.map(String)
4343
}
4444
return []
4545
})
46-
const rederDictTag = () => {
46+
const renderDictTag = () => {
4747
if (!props.type) {
4848
return null
4949
}
@@ -58,7 +58,7 @@ export default defineComponent({
5858
class="dict-tag"
5959
style={{
6060
display: 'flex',
61-
gap: props.tagSpacing,
61+
gap: props.gutter,
6262
justifyContent: 'center',
6363
alignItems: 'center'
6464
}}
@@ -84,7 +84,7 @@ export default defineComponent({
8484
</div>
8585
)
8686
}
87-
return () => rederDictTag()
87+
return () => renderDictTag()
8888
}
8989
})
9090
</script>

0 commit comments

Comments
 (0)