From 6edd64f13bf8896f1eb5bd24a8f40f9277ad08b3 Mon Sep 17 00:00:00 2001 From: GoldenZqqqq <1361001127@qq.com> Date: Sun, 4 Aug 2024 02:05:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20DictTag=E7=BB=84=E4=BB=B6=E5=8A=A0?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E5=88=86=E9=9A=94=E7=AC=A6props?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E7=81=B5=E6=B4=BB=E5=AE=9A=E4=B9=89split?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=9A=84=E5=88=86=E9=9A=94=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DictTag/src/DictTag.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/DictTag/src/DictTag.vue b/src/components/DictTag/src/DictTag.vue index faa5b926..93e15053 100644 --- a/src/components/DictTag/src/DictTag.vue +++ b/src/components/DictTag/src/DictTag.vue @@ -15,6 +15,11 @@ export default defineComponent({ value: { type: [String, Number, Boolean, Array], required: true + }, + // 字符串分隔符 只有当 props.value 传入值为字符串时有效 + sepSymbol: { + type: String as PropType, + 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)) {