feat(element-plus-adapter, from, tdesign-vue-adapter): button兼容type=default和type为空的情况

This commit is contained in:
roymondchen 2025-10-31 11:58:26 +08:00
parent 09663c8320
commit 2a29971318
4 changed files with 9 additions and 4 deletions

View File

@ -111,7 +111,12 @@ const adapter: DesignPluginOptions = {
button: { button: {
component: ElButton as any, component: ElButton as any,
props: (props: ButtonProps) => props, props: (props: ButtonProps) => {
return {
...props,
type: props.type === 'default' ? '' : props.type,
};
},
}, },
card: { card: {

View File

@ -42,7 +42,7 @@
</TMagicCol> </TMagicCol>
<TMagicCol :span="12"> <TMagicCol :span="12">
<slot name="footer"> <slot name="footer">
<TMagicButton type="default" @click="cancel" size="small"> </TMagicButton> <TMagicButton @click="cancel" size="small"> </TMagicButton>
<TMagicButton v-if="hasStep && stepActive > 1" type="info" size="small" @click="preStep" <TMagicButton v-if="hasStep && stepActive > 1" type="info" size="small" @click="preStep"
>上一步</TMagicButton >上一步</TMagicButton
> >

View File

@ -42,7 +42,7 @@
</TMagicCol> </TMagicCol>
<TMagicCol :span="12"> <TMagicCol :span="12">
<slot name="footer"> <slot name="footer">
<TMagicButton type="default" @click="handleClose">关闭</TMagicButton> <TMagicButton @click="handleClose">关闭</TMagicButton>
<TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{ <TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
confirmText confirmText
}}</TMagicButton> }}</TMagicButton>

View File

@ -180,7 +180,7 @@ const adapter: any = {
button: { button: {
component: TButton, component: TButton,
props: (props: ButtonProps) => ({ props: (props: ButtonProps) => ({
theme: props.type, theme: props.type ? props.type : 'default',
size: props.size === 'default' ? 'medium' : props.size, size: props.size === 'default' ? 'medium' : props.size,
icon: props.icon ? () => h(Icon, null, { default: () => h(props.icon) }) : undefined, icon: props.icon ? () => h(Icon, null, { default: () => h(props.icon) }) : undefined,
variant: props.link || props.text ? 'text' : props.variant || 'base', variant: props.link || props.text ? 'text' : props.variant || 'base',