feat: update vc-tabs to 9.6.1

pull/666/head
wangxueliang 2019-03-04 14:57:51 +08:00
parent 0593665d7c
commit 8713210000
4 changed files with 14 additions and 7 deletions

View File

@ -22,12 +22,13 @@ export default {
render() {
const props = { ...this.$props };
const listeners = this.$listeners;
const { renderTabBarNode } = this.scopedSlots;
return (
<SaveRef
children={(saveRef, getRef) => (
<TabBarRootNode saveRef={saveRef} {...{ props, on: listeners }}>
<ScrollableTabBarNode saveRef={saveRef} getRef={getRef} {...{ props, on: listeners }}>
<TabBarTabsNode saveRef={saveRef} {...{ props, on: listeners }} />
<TabBarTabsNode saveRef={saveRef} {...{ props: {...props, renderTabBarNode}, on: listeners }} />
<InkTabBarNode saveRef={saveRef} getRef={getRef} {...{ props, on: listeners }} />
</ScrollableTabBarNode>
</TabBarRootNode>

View File

@ -10,13 +10,13 @@ export default {
name: 'ScrollableTabBarNode',
mixins: [BaseMixin],
props: {
saveRef: PropTypes.func.def(() => {}),
activeKey: PropTypes.any,
getRef: PropTypes.func.def(() => {}),
saveRef: PropTypes.func.def(() => {}),
tabBarPosition: PropTypes.oneOf(['left', 'right', 'top', 'bottom']).def('left'),
prefixCls: PropTypes.string.def(''),
scrollAnimated: PropTypes.bool.def(true),
navWrapper: PropTypes.func.def(arg => arg),
activeKey: PropTypes.any,
prevIcon: PropTypes.any,
nextIcon: PropTypes.any,
},

View File

@ -15,6 +15,7 @@ export default {
onTabClick: PropTypes.func,
saveRef: PropTypes.func.def(noop),
getRef: PropTypes.func.def(noop),
renderTabBarNode: PropTypes.func,
tabBarPosition: PropTypes.string,
},
render() {
@ -27,7 +28,7 @@ export default {
tabBarPosition,
} = this.$props;
const rst = [];
const renderTabBarNode = this.renderTabBarNode || this.$scopedSlots.renderTabBarNode;
children.forEach((child, index) => {
if (!child) {
return;
@ -59,7 +60,7 @@ export default {
[isVertical(tabBarPosition) ? 'marginBottom' : 'marginRight']: gutter,
};
warning(tab !== undefined, 'There must be `tab` property or slot on children of Tabs.');
rst.push(
let node = (
<div
role="tab"
aria-disabled={disabled ? 'true' : 'false'}
@ -71,8 +72,13 @@ export default {
{...{ directives: directives }}
>
{tab}
</div>,
</div>
);
if (renderTabBarNode) {
node = renderTabBarNode(node);
}
rst.push(node);
});
return (

View File

@ -1,4 +1,4 @@
// based on rc-tabs 9.5.8
// based on rc-tabs 9.6.1
import ref from 'vue-ref';
import Vue from 'vue';
import Tabs from './Tabs';