feat: DictTag组件加字符串分隔符props,更灵活定义split字符串的分隔符

pull/493/head
GoldenZqqqq 2024-08-04 02:05:16 +08:00
parent c015b2e881
commit 6edd64f13b
1 changed files with 7 additions and 2 deletions

View File

@ -15,6 +15,11 @@ export default defineComponent({
value: {
type: [String, Number, Boolean, Array],
required: true
},
// props.value
sepSymbol: {
type: String as PropType<string>,
default: ','
}
},
setup(props) {
@ -23,9 +28,9 @@ export default defineComponent({
if (isNumber(props.value)) {
return [String(props.value)]
}
// 2.','
// 2. -> props.sepSymbol
else if (isString(props.value)) {
return props.value.includes(',') ? props.value.split(',') : [String(props.value)]
return props.value.split(props.sepSymbol)
}
// 3.
else if (isArray(props.value)) {