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: {