From 90492ad3eac82f052e99e7a286772a3feac288f7 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Mon, 6 Jul 2026 16:48:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(adapters):=20tag=20=E9=9D=9E=E6=B3=95=20typ?= =?UTF-8?q?e=20=E5=9B=9E=E9=80=80=E4=B8=BA=E9=BB=98=E8=AE=A4=E4=B8=BB?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- packages/element-plus-adapter/src/index.ts | 8 +++++++- packages/tdesign-vue-next-adapter/src/index.ts | 9 ++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/element-plus-adapter/src/index.ts b/packages/element-plus-adapter/src/index.ts index 4f326ae6..eea093c5 100644 --- a/packages/element-plus-adapter/src/index.ts +++ b/packages/element-plus-adapter/src/index.ts @@ -296,7 +296,13 @@ const adapter: DesignPluginOptions = { tag: { component: ElTag as any, - props: (props: TagProps) => props, + props: (props: TagProps) => { + const VALID_TAG_TYPES = ['primary', 'success', 'info', 'warning', 'danger']; + if (props.type && !VALID_TAG_TYPES.includes(props.type)) { + return { ...props, type: 'primary' }; + } + return props; + }, }, timePicker: { diff --git a/packages/tdesign-vue-next-adapter/src/index.ts b/packages/tdesign-vue-next-adapter/src/index.ts index df5910e2..e51376e0 100644 --- a/packages/tdesign-vue-next-adapter/src/index.ts +++ b/packages/tdesign-vue-next-adapter/src/index.ts @@ -494,9 +494,12 @@ const adapter: any = { tag: { component: TTag, - props: (props: TagProps) => ({ - theme: props.type ? props.type : 'default', - }), + props: (props: TagProps) => { + const VALID_TAG_THEMES = ['default', 'primary', 'warning', 'danger', 'success']; + return { + theme: props.type && VALID_TAG_THEMES.includes(props.type) ? props.type : 'default', + }; + }, }, timePicker: {