@@ -5,6 +5,7 @@ import omit from 'omit.js';
55import Wave from '../_util/wave' ;
66import { hasProp } from '../_util/props-util' ;
77import BaseMixin from '../_util/BaseMixin' ;
8+ import { ConfigConsumerProps } from '../config-provider' ;
89
910export default {
1011 name : 'ATag' ,
@@ -14,12 +15,15 @@ export default {
1415 event : 'close.visible' ,
1516 } ,
1617 props : {
17- prefixCls : PropTypes . string . def ( 'ant-tag' ) ,
18+ prefixCls : PropTypes . string ,
1819 color : PropTypes . string ,
1920 closable : PropTypes . bool . def ( false ) ,
2021 visible : PropTypes . bool ,
2122 afterClose : PropTypes . func ,
2223 } ,
24+ inject : {
25+ configProvider : { default : ( ) => ConfigConsumerProps } ,
26+ } ,
2327 data ( ) {
2428 let _visible = true ;
2529 if ( hasProp ( this , 'visible' ) ) {
@@ -75,8 +79,8 @@ export default {
7579 } ;
7680 } ,
7781
78- getTagClassName ( ) {
79- const { prefixCls , color } = this . $props ;
82+ getTagClassName ( prefixCls ) {
83+ const { color } = this . $props ;
8084 const isPresetColor = this . isPresetColor ( color ) ;
8185 return {
8286 [ prefixCls ] : true ,
@@ -92,13 +96,15 @@ export default {
9296 } ,
9397
9498 render ( ) {
95- const { prefixCls } = this . $props ;
99+ const { prefixCls : customizePrefixCls } = this . $props ;
100+ const getPrefixCls = this . configProvider . getPrefixCls ;
101+ const prefixCls = getPrefixCls ( 'tag' , customizePrefixCls ) ;
96102 const { _visible : visible } = this . $data ;
97103 const tag = (
98104 < div
99105 v-show = { visible }
100106 { ...{ on : omit ( this . $listeners , [ 'close' ] ) } }
101- class = { this . getTagClassName ( ) }
107+ class = { this . getTagClassName ( prefixCls ) }
102108 style = { this . getTagStyle ( ) }
103109 >
104110 { this . $slots . default }
0 commit comments