11import Icon from '../icon' ;
22import ScrollableInkTabBar from '../vc-tabs/src/ScrollableInkTabBar' ;
33import { cloneElement } from '../_util/vnode' ;
4+ import PropTypes from '../_util/vue-types' ;
5+ import { getListeners } from '../_util/props-util' ;
46const TabBar = {
5- functional : true ,
6- render ( h , context ) {
7+ name : 'TabBar' ,
8+ inheritAttrs : false ,
9+ props : {
10+ prefixCls : PropTypes . string ,
11+ tabBarStyle : PropTypes . object ,
12+ tabBarExtraContent : PropTypes . any ,
13+ type : PropTypes . oneOf ( [ 'line' , 'card' , 'editable-card' ] ) ,
14+ tabPosition : PropTypes . oneOf ( [ 'top' , 'right' , 'bottom' , 'left' ] ) . def ( 'top' ) ,
15+ tabBarPosition : PropTypes . oneOf ( [ 'top' , 'right' , 'bottom' , 'left' ] ) ,
16+ size : PropTypes . oneOf ( [ 'default' , 'small' , 'large' ] ) ,
17+ animated : PropTypes . oneOfType ( [ PropTypes . bool , PropTypes . object ] ) ,
18+ renderTabBar : PropTypes . func ,
19+ panels : PropTypes . array . def ( [ ] ) ,
20+ activeKey : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
21+ } ,
22+ render ( ) {
723 const {
824 tabBarStyle,
925 animated = true ,
@@ -13,7 +29,7 @@ const TabBar = {
1329 prefixCls,
1430 type = 'line' ,
1531 size,
16- } = context . props ;
32+ } = this . $ props;
1733 const inkBarAnimated = typeof animated === 'object' ? animated . inkBar : animated ;
1834
1935 const isVertical = tabPosition === 'left' || tabPosition === 'right' ;
@@ -39,14 +55,15 @@ const TabBar = {
3955
4056 const renderProps = {
4157 props : {
42- ...context . props ,
58+ ...this . $props ,
59+ ...this . $attrs ,
4360 inkBarAnimated,
4461 extraContent : tabBarExtraContent ,
4562 prevIcon,
4663 nextIcon,
4764 } ,
4865 style : tabBarStyle ,
49- on : context . listeners ,
66+ on : getListeners ( this ) ,
5067 class : cls ,
5168 } ;
5269
@@ -58,7 +75,7 @@ const TabBar = {
5875 RenderTabBar = < ScrollableInkTabBar { ...renderProps } /> ;
5976 }
6077
61- return cloneElement ( RenderTabBar , renderProps ) ;
78+ return cloneElement ( RenderTabBar ) ;
6279 } ,
6380} ;
6481
0 commit comments