From 3064320fee3cf8ce4da8feb0db17041ac01c8ebf Mon Sep 17 00:00:00 2001 From: syt Date: Fri, 12 Jun 2020 10:21:18 +0800 Subject: [PATCH] fix: configProvider inject --- components/tag/Tag.jsx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/components/tag/Tag.jsx b/components/tag/Tag.jsx index 9fbe355c61..0971e8a774 100644 --- a/components/tag/Tag.jsx +++ b/components/tag/Tag.jsx @@ -1,8 +1,7 @@ -import { Transition } from 'vue'; +import { Transition, inject } from 'vue'; import CloseOutlined from '@ant-design/icons-vue/CloseOutlined'; import PropTypes from '../_util/vue-types'; import getTransitionProps from '../_util/getTransitionProps'; -import omit from 'omit.js'; import Wave from '../_util/wave'; import { hasProp, getOptionProps } from '../_util/props-util'; import BaseMixin from '../_util/BaseMixin'; @@ -36,8 +35,10 @@ export default { visible: PropTypes.bool, afterClose: PropTypes.func, }, - inject: { - configProvider: { default: () => ConfigConsumerProps }, + setup() { + return { + configProvider: inject('configProvider', ConfigConsumerProps), + }; }, data() { let _visible = true; @@ -116,16 +117,11 @@ export default { render() { const { prefixCls: customizePrefixCls } = this.$props; - const getPrefixCls = this.configProvider().getPrefixCls; + const getPrefixCls = this.configProvider.getPrefixCls; const prefixCls = getPrefixCls('tag', customizePrefixCls); const { _visible: visible } = this.$data; const tag = ( - + {this.$slots.default()} {this.renderCloseIcon()}