fix(adapters): tag 非法 type 回退为默认主题

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
roymondchen 2026-07-06 16:48:45 +08:00
parent b183e71f64
commit 90492ad3ea
2 changed files with 13 additions and 4 deletions

View File

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

View File

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