mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-07-06 17:31:11 +08:00
fix(adapters): tag 非法 type 回退为默认主题
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
b183e71f64
commit
90492ad3ea
@ -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: {
|
||||
|
||||
@ -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: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user