From 1377fe762eadc9e3aad4480e731a1068f399d64d Mon Sep 17 00:00:00 2001 From: daief <1437931235@qq.com> Date: Wed, 15 Feb 2023 15:35:35 +0800 Subject: [PATCH] fix: button default variant --- src/components/button/button.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/button/button.tsx b/src/components/button/button.tsx index dcdb260..bf7074d 100644 --- a/src/components/button/button.tsx +++ b/src/components/button/button.tsx @@ -36,7 +36,7 @@ export const buttonProps = { }, shape: { type: String as PropType, - default: 'neutral', + default: '', }, size: { type: String as PropType, @@ -73,16 +73,19 @@ export const Button = componentV2< ); const cls = computed(() => { + let variantCls = ''; + if (props.variant === 'glass') { + variantCls = 'dv-glass'; + } else if (props.variant) { + variantCls = + props.variant !== 'neutral' ? `dv-btn-${props.variant}` : ''; + } return [ 'dv-btn', - props.variant === 'glass' - ? 'dv-glass' - : !!props.variant - ? `dv-btn-${props.variant}` - : '', + variantCls, { [`dv-btn-${size.value}`]: true, - [`dv-btn-${shape.value}`]: true, + [`dv-btn-${shape.value}`]: !!shape.value, 'dv-btn-block': props.block, 'dv-btn-wide': props.wide, 'dv-loading': finalLoading.value,