From 789f202e5529248d3ea73af478026813b8e8d197 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 12 Jun 2025 09:59:24 +0800 Subject: [PATCH] feat: dict tag supper hexColor --- .../src/components/dict-tag/dict-tag.vue | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/apps/web-antd/src/components/dict-tag/dict-tag.vue b/apps/web-antd/src/components/dict-tag/dict-tag.vue index fb26b4ae1..7d9a5f1f3 100644 --- a/apps/web-antd/src/components/dict-tag/dict-tag.vue +++ b/apps/web-antd/src/components/dict-tag/dict-tag.vue @@ -23,6 +23,11 @@ interface DictTagProps { const props = defineProps(); +function isHexColor(color: string) { + const reg = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i; + return reg.test(color); +} + /** 获取字典标签 */ const dictTag = computed(() => { // 校验参数有效性 @@ -66,7 +71,16 @@ const dictTag = computed(() => {