@@ -5,6 +5,7 @@ import omit from 'omit.js';
5
5
import Wave from '../_util/wave' ;
6
6
import { hasProp } from '../_util/props-util' ;
7
7
import BaseMixin from '../_util/BaseMixin' ;
8
+ import { ConfigConsumerProps } from '../config-provider' ;
8
9
9
10
export default {
10
11
name : 'ATag' ,
@@ -14,12 +15,15 @@ export default {
14
15
event : 'close.visible' ,
15
16
} ,
16
17
props : {
17
- prefixCls : PropTypes . string . def ( 'ant-tag' ) ,
18
+ prefixCls : PropTypes . string ,
18
19
color : PropTypes . string ,
19
20
closable : PropTypes . bool . def ( false ) ,
20
21
visible : PropTypes . bool ,
21
22
afterClose : PropTypes . func ,
22
23
} ,
24
+ inject : {
25
+ configProvider : { default : ( ) => ConfigConsumerProps } ,
26
+ } ,
23
27
data ( ) {
24
28
let _visible = true ;
25
29
if ( hasProp ( this , 'visible' ) ) {
@@ -75,8 +79,8 @@ export default {
75
79
} ;
76
80
} ,
77
81
78
- getTagClassName ( ) {
79
- const { prefixCls , color } = this . $props ;
82
+ getTagClassName ( prefixCls ) {
83
+ const { color } = this . $props ;
80
84
const isPresetColor = this . isPresetColor ( color ) ;
81
85
return {
82
86
[ prefixCls ] : true ,
@@ -92,13 +96,15 @@ export default {
92
96
} ,
93
97
94
98
render ( ) {
95
- const { prefixCls } = this . $props ;
99
+ const { prefixCls : customizePrefixCls } = this . $props ;
100
+ const getPrefixCls = this . configProvider . getPrefixCls ;
101
+ const prefixCls = getPrefixCls ( 'tag' , customizePrefixCls ) ;
96
102
const { _visible : visible } = this . $data ;
97
103
const tag = (
98
104
< div
99
105
v-show = { visible }
100
106
{ ...{ on : omit ( this . $listeners , [ 'close' ] ) } }
101
- class = { this . getTagClassName ( ) }
107
+ class = { this . getTagClassName ( prefixCls ) }
102
108
style = { this . getTagStyle ( ) }
103
109
>
104
110
{ this . $slots . default }
0 commit comments