Browse Source

fix: tag

pull/2933/head
Amour1688 4 years ago
parent
commit
b19ca0aaaf
  1. 40
      components/tag/index.tsx

40
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;

Loading…
Cancel
Save