@@ -5,6 +5,7 @@ import isFlexSupported from '../_util/isFlexSupported';
5
5
import PropTypes from '../_util/vue-types' ;
6
6
import { getComponentFromProp , getOptionProps , filterEmpty } from '../_util/props-util' ;
7
7
import { cloneElement } from '../_util/vnode' ;
8
+ import { ConfigConsumerProps } from '../config-provider' ;
8
9
import TabBar from './TabBar' ;
9
10
10
11
export default {
@@ -15,7 +16,7 @@ export default {
15
16
event : 'change' ,
16
17
} ,
17
18
props : {
18
- prefixCls : PropTypes . string . def ( 'ant-tabs' ) ,
19
+ prefixCls : PropTypes . string ,
19
20
activeKey : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
20
21
defaultActiveKey : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
21
22
hideAdd : PropTypes . bool . def ( false ) ,
@@ -29,6 +30,9 @@ export default {
29
30
tabBarGutter : PropTypes . number ,
30
31
renderTabBar : PropTypes . func ,
31
32
} ,
33
+ inject : {
34
+ configProvider : { default : ( ) => ( { } ) } ,
35
+ } ,
32
36
mounted ( ) {
33
37
const NO_FLEX = ' no-flex' ;
34
38
const tabNode = this . $el ;
@@ -64,14 +68,16 @@ export default {
64
68
render ( ) {
65
69
const props = getOptionProps ( this ) ;
66
70
const {
67
- prefixCls,
71
+ prefixCls : customizePrefixCls ,
68
72
size,
69
73
type = 'line' ,
70
74
tabPosition,
71
75
animated = true ,
72
76
hideAdd,
73
77
renderTabBar,
74
78
} = props ;
79
+ const getPrefixCls = this . configProvider . getPrefixCls || ConfigConsumerProps . getPrefixCls ;
80
+ const prefixCls = getPrefixCls ( 'tabs' , customizePrefixCls ) ;
75
81
const children = filterEmpty ( this . $slots . default ) ;
76
82
77
83
let tabBarExtraContent = getComponentFromProp ( this , 'tabBarExtraContent' ) ;
@@ -136,6 +142,7 @@ export default {
136
142
const tabBarProps = {
137
143
props : {
138
144
...this . $props ,
145
+ prefixCls,
139
146
tabBarExtraContent,
140
147
renderTabBar : renderTabBarSlot ,
141
148
} ,
@@ -148,6 +155,7 @@ export default {
148
155
const tabsProps = {
149
156
props : {
150
157
...getOptionProps ( this ) ,
158
+ prefixCls,
151
159
tabBarPosition : tabPosition ,
152
160
renderTabBar : ( ) => < TabBar { ...tabBarProps } /> ,
153
161
renderTabContent : ( ) => (
0 commit comments