diff --git a/components/tag/index.tsx b/components/tag/index.tsx index 8a0d564d4..e321ecc03 100644 --- a/components/tag/index.tsx +++ b/components/tag/index.tsx @@ -5,7 +5,6 @@ import { defineComponent, SetupContext, App, - watchEffect, VNodeTypes, CSSProperties, } from 'vue'; @@ -44,29 +43,8 @@ const Tag = defineComponent({ const { getPrefixCls } = inject('configProvider', defaultConfigProvider); const visible = ref(true); - const props = attrs as TagProps; - watchEffect(() => { - if ('visible' in props) { - visible.value = props.visible!; - } - }); - - const handleCloseClick = (e: MouseEvent) => { - e.stopPropagation(); - if (props.onClose) { - props.onClose(e); - } - - if (e.defaultPrevented) { - return; - } - if (!('visible' in props)) { - visible.value = false; - } - }; - return () => { const { prefixCls: customizePrefixCls, @@ -79,6 +57,24 @@ const Tag = defineComponent({ ...restProps } = props; + if ('visible' in props) { + visible.value = props.visible!; + } + + const handleCloseClick = (e: MouseEvent) => { + e.stopPropagation(); + if (props.onClose) { + props.onClose(e); + } + + if (e.defaultPrevented) { + return; + } + if (!('visible' in props)) { + visible.value = false; + } + }; + const isPresetColor = (): boolean => { if (!color) { return false;