feat: update tag
parent
ee3a7179f6
commit
41129be9b6
|
@ -0,0 +1,11 @@
|
||||||
|
## Tag
|
||||||
|
|
||||||
|
### CheckableTag
|
||||||
|
|
||||||
|
v-model -> v-model:checked
|
||||||
|
|
||||||
|
### Tag
|
||||||
|
|
||||||
|
v-model -> v-model:visible
|
||||||
|
|
||||||
|
移除 afterClose 属性
|
|
@ -7,6 +7,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
checked: PropTypes.bool,
|
checked: PropTypes.bool,
|
||||||
|
onChange: PropTypes.func,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import { Transition, inject } from 'vue';
|
import { inject } from 'vue';
|
||||||
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
|
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
|
||||||
import PropTypes from '../_util/vue-types';
|
import PropTypes from '../_util/vue-types';
|
||||||
import getTransitionProps from '../_util/getTransitionProps';
|
|
||||||
import Wave from '../_util/wave';
|
import Wave from '../_util/wave';
|
||||||
import { hasProp, getOptionProps } from '../_util/props-util';
|
import { hasProp, getOptionProps } from '../_util/props-util';
|
||||||
import BaseMixin from '../_util/BaseMixin';
|
import BaseMixin from '../_util/BaseMixin';
|
||||||
import { ConfigConsumerProps } from '../config-provider';
|
import { ConfigConsumerProps } from '../config-provider';
|
||||||
import warning from '../_util/warning';
|
|
||||||
|
|
||||||
const PresetColorTypes = [
|
const PresetColorTypes = [
|
||||||
'pink',
|
'pink',
|
||||||
|
@ -33,7 +31,7 @@ export default {
|
||||||
color: PropTypes.string,
|
color: PropTypes.string,
|
||||||
closable: PropTypes.bool.def(false),
|
closable: PropTypes.bool.def(false),
|
||||||
visible: PropTypes.bool,
|
visible: PropTypes.bool,
|
||||||
afterClose: PropTypes.func,
|
onClose: PropTypes.func,
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
|
@ -46,11 +44,6 @@ export default {
|
||||||
if ('visible' in props) {
|
if ('visible' in props) {
|
||||||
_visible = this.visible;
|
_visible = this.visible;
|
||||||
}
|
}
|
||||||
warning(
|
|
||||||
!('afterClose' in props),
|
|
||||||
'Tag',
|
|
||||||
"'afterClose' will be deprecated, please use 'close' event, we will remove this in the next version.",
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
_visible,
|
_visible,
|
||||||
};
|
};
|
||||||
|
@ -66,11 +59,6 @@ export default {
|
||||||
setVisible(visible, e) {
|
setVisible(visible, e) {
|
||||||
this.$emit('close', e);
|
this.$emit('close', e);
|
||||||
this.$emit('update:visible', false);
|
this.$emit('update:visible', false);
|
||||||
const afterClose = this.afterClose;
|
|
||||||
if (afterClose) {
|
|
||||||
// next version remove.
|
|
||||||
afterClose();
|
|
||||||
}
|
|
||||||
if (e.defaultPrevented) {
|
if (e.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -117,22 +105,16 @@ export default {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { prefixCls: customizePrefixCls } = this.$props;
|
const { prefixCls: customizePrefixCls } = this.$props;
|
||||||
|
const isNeedWave = 'onClick' in this.$attrs;
|
||||||
const getPrefixCls = this.configProvider.getPrefixCls;
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
||||||
const prefixCls = getPrefixCls('tag', customizePrefixCls);
|
const prefixCls = getPrefixCls('tag', customizePrefixCls);
|
||||||
const { _visible: visible } = this.$data;
|
const { _visible: visible } = this.$data;
|
||||||
const tag = (
|
const tag = (
|
||||||
<span v-show={visible} class={this.getTagClassName(prefixCls)} style={this.getTagStyle()}>
|
<span v-show={visible} class={this.getTagClassName(prefixCls)} style={this.getTagStyle()}>
|
||||||
{this.$slots.default()}
|
{this.$slots.default && this.$slots.default()}
|
||||||
{this.renderCloseIcon()}
|
{this.renderCloseIcon()}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
const transitionProps = getTransitionProps(`${prefixCls}-zoom`, {
|
return isNeedWave ? <Wave>{tag}</Wave> : tag;
|
||||||
appear: false,
|
|
||||||
});
|
|
||||||
return (
|
|
||||||
<Wave>
|
|
||||||
<Transition {...transitionProps}>{tag}</Transition>
|
|
||||||
</Wave>
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue