diff --git a/src/tag/index.less b/src/tag/index.less index f01fc6235..d745b518e 100644 --- a/src/tag/index.less +++ b/src/tag/index.less @@ -83,6 +83,7 @@ } &__close { + min-width: 1em; margin-left: 2px; } } diff --git a/src/tag/index.tsx b/src/tag/index.tsx index 4ab2d814c..353595767 100644 --- a/src/tag/index.tsx +++ b/src/tag/index.tsx @@ -44,31 +44,30 @@ function Tag( classes[size] = size; } - const Content = ( - - {slots.default?.()} - {props.closeable && ( - { - event.stopPropagation(); - emit(ctx, 'close'); - }} - /> - )} - + const CloseIcon = props.closeable && ( + { + event.stopPropagation(); + emit(ctx, 'close'); + }} + /> ); - if (props.closeable) { - return {Content}; - } - - return Content; + return ( + + + {slots.default?.()} + {CloseIcon} + + + ); } Tag.props = {