【代码优化】DictTag 的 render 方法的命名,属性的命名

pull/493/head
YunaiV 2024-08-08 23:47:23 +08:00
parent f7d31d5c99
commit de9ec95099
1 changed files with 7 additions and 7 deletions

View File

@ -17,12 +17,12 @@ export default defineComponent({
required: true required: true
}, },
// props.value // props.value
sepSymbol: { separator: {
type: String as PropType<string>, type: String as PropType<string>,
default: ',' default: ','
}, },
// tag5px // tag 5px el-row gutter
tagSpacing: { gutter: {
type: String as PropType<string>, type: String as PropType<string>,
default: '5px' default: '5px'
} }
@ -35,7 +35,7 @@ export default defineComponent({
} }
// 2. -> props.sepSymbol // 2. -> props.sepSymbol
else if (isString(props.value)) { else if (isString(props.value)) {
return props.value.split(props.sepSymbol) return props.value.split(props.separator)
} }
// 3. // 3.
else if (isArray(props.value)) { else if (isArray(props.value)) {
@ -43,7 +43,7 @@ export default defineComponent({
} }
return [] return []
}) })
const rederDictTag = () => { const renderDictTag = () => {
if (!props.type) { if (!props.type) {
return null return null
} }
@ -58,7 +58,7 @@ export default defineComponent({
class="dict-tag" class="dict-tag"
style={{ style={{
display: 'flex', display: 'flex',
gap: props.tagSpacing, gap: props.gutter,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center' alignItems: 'center'
}} }}
@ -84,7 +84,7 @@ export default defineComponent({
</div> </div>
) )
} }
return () => rederDictTag() return () => renderDictTag()
} }
}) })
</script> </script>