|
1 |
| -import { Transition } from 'vue'; |
| 1 | +import { Transition, inject } from 'vue'; |
2 | 2 | import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
|
3 | 3 | import PropTypes from '../_util/vue-types';
|
4 | 4 | import getTransitionProps from '../_util/getTransitionProps';
|
5 |
| -import omit from 'omit.js'; |
6 | 5 | import Wave from '../_util/wave';
|
7 | 6 | import { hasProp, getOptionProps } from '../_util/props-util';
|
8 | 7 | import BaseMixin from '../_util/BaseMixin';
|
@@ -36,8 +35,10 @@ export default {
|
36 | 35 | visible: PropTypes.bool,
|
37 | 36 | afterClose: PropTypes.func,
|
38 | 37 | },
|
39 |
| - inject: { |
40 |
| - configProvider: { default: () => ConfigConsumerProps }, |
| 38 | + setup() { |
| 39 | + return { |
| 40 | + configProvider: inject('configProvider', ConfigConsumerProps), |
| 41 | + }; |
41 | 42 | },
|
42 | 43 | data() {
|
43 | 44 | let _visible = true;
|
@@ -116,16 +117,11 @@ export default {
|
116 | 117 |
|
117 | 118 | render() {
|
118 | 119 | const { prefixCls: customizePrefixCls } = this.$props;
|
119 |
| - const getPrefixCls = this.configProvider().getPrefixCls; |
| 120 | + const getPrefixCls = this.configProvider.getPrefixCls; |
120 | 121 | const prefixCls = getPrefixCls('tag', customizePrefixCls);
|
121 | 122 | const { _visible: visible } = this.$data;
|
122 | 123 | const tag = (
|
123 |
| - <span |
124 |
| - v-show={visible} |
125 |
| - class={this.getTagClassName(prefixCls)} |
126 |
| - style={this.getTagStyle()} |
127 |
| - {...omit(this.$attr, ['onClose'])} |
128 |
| - > |
| 124 | + <span v-show={visible} class={this.getTagClassName(prefixCls)} style={this.getTagStyle()}> |
129 | 125 | {this.$slots.default()}
|
130 | 126 | {this.renderCloseIcon()}
|
131 | 127 | </span>
|
|
0 commit comments