Skip to content

Commit 3064320

Browse files
committed
fix: configProvider inject
1 parent 455034c commit 3064320

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

components/tag/Tag.jsx

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { Transition } from 'vue';
1+
import { Transition, inject } from 'vue';
22
import CloseOutlined from '@ant-design/icons-vue/CloseOutlined';
33
import PropTypes from '../_util/vue-types';
44
import getTransitionProps from '../_util/getTransitionProps';
5-
import omit from 'omit.js';
65
import Wave from '../_util/wave';
76
import { hasProp, getOptionProps } from '../_util/props-util';
87
import BaseMixin from '../_util/BaseMixin';
@@ -36,8 +35,10 @@ export default {
3635
visible: PropTypes.bool,
3736
afterClose: PropTypes.func,
3837
},
39-
inject: {
40-
configProvider: { default: () => ConfigConsumerProps },
38+
setup() {
39+
return {
40+
configProvider: inject('configProvider', ConfigConsumerProps),
41+
};
4142
},
4243
data() {
4344
let _visible = true;
@@ -116,16 +117,11 @@ export default {
116117

117118
render() {
118119
const { prefixCls: customizePrefixCls } = this.$props;
119-
const getPrefixCls = this.configProvider().getPrefixCls;
120+
const getPrefixCls = this.configProvider.getPrefixCls;
120121
const prefixCls = getPrefixCls('tag', customizePrefixCls);
121122
const { _visible: visible } = this.$data;
122123
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()}>
129125
{this.$slots.default()}
130126
{this.renderCloseIcon()}
131127
</span>

0 commit comments

Comments
 (0)