pull/9/head
parent
09500d37eb
commit
4204283766
|
@ -91,7 +91,7 @@ export default {
|
||||||
const {
|
const {
|
||||||
prefixCls, onKeyDown, tabBarPosition, hideAdd,
|
prefixCls, onKeyDown, tabBarPosition, hideAdd,
|
||||||
} = this
|
} = this
|
||||||
let extraContent = this.extraContent
|
let extraContent = this.$slots.extraContent
|
||||||
const tabsType = this.$parent.type
|
const tabsType = this.$parent.type
|
||||||
const cls = {
|
const cls = {
|
||||||
[`${prefixCls}-bar`]: true,
|
[`${prefixCls}-bar`]: true,
|
||||||
|
@ -99,8 +99,6 @@ export default {
|
||||||
const topOrBottom = (tabBarPosition === 'top' || tabBarPosition === 'bottom')
|
const topOrBottom = (tabBarPosition === 'top' || tabBarPosition === 'bottom')
|
||||||
const tabBarExtraContentStyle = topOrBottom ? { float: 'right' } : {}
|
const tabBarExtraContentStyle = topOrBottom ? { float: 'right' } : {}
|
||||||
let children = contents
|
let children = contents
|
||||||
extraContent = typeof extraContent === 'function' ? extraContent(createElement) : extraContent
|
|
||||||
extraContent = extraContent || this.$slots.extraContent
|
|
||||||
if (tabsType === 'editable-card' && !hideAdd) {
|
if (tabsType === 'editable-card' && !hideAdd) {
|
||||||
extraContent = (
|
extraContent = (
|
||||||
<span>
|
<span>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: 'TabPane',
|
name: 'TabPane',
|
||||||
props: {
|
props: {
|
||||||
tab: [String, Number, Function],
|
tab: [String, Number, Function, Array],
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
closable: Boolean,
|
closable: Boolean,
|
||||||
forceRender: Boolean,
|
forceRender: Boolean,
|
||||||
|
|
|
@ -163,7 +163,7 @@ export default {
|
||||||
if (componentOptions) {
|
if (componentOptions) {
|
||||||
if (componentOptions.propsData.tab === undefined) {
|
if (componentOptions.propsData.tab === undefined) {
|
||||||
componentOptions.propsData.tab = $slots[`tab_${tabKey}`]
|
componentOptions.propsData.tab = $slots[`tab_${tabKey}`]
|
||||||
? h => h('span', [$slots[`tab_${tabKey}`]])
|
? $slots[`tab_${tabKey}`]
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
panels.push({ ...componentOptions.propsData, tabKey })
|
panels.push({ ...componentOptions.propsData, tabKey })
|
||||||
|
@ -195,9 +195,9 @@ export default {
|
||||||
}
|
}
|
||||||
const contents = [
|
const contents = [
|
||||||
<ScrollableInkTabBar {...tabBarProps}>
|
<ScrollableInkTabBar {...tabBarProps}>
|
||||||
{$slots.tabBarExtraContent ? <span slot='extraContent'>
|
{$slots.tabBarExtraContent ? <template slot='extraContent'>
|
||||||
{$slots.tabBarExtraContent}
|
{$slots.tabBarExtraContent}
|
||||||
</span> : null}
|
</template> : null}
|
||||||
</ScrollableInkTabBar>,
|
</ScrollableInkTabBar>,
|
||||||
<TabContent {...tabContentProps}>
|
<TabContent {...tabContentProps}>
|
||||||
{$slots.default}
|
{$slots.default}
|
||||||
|
|
|
@ -102,18 +102,18 @@ export default {
|
||||||
[`${prefixCls}-no-animation`]: !tabPaneAnimated,
|
[`${prefixCls}-no-animation`]: !tabPaneAnimated,
|
||||||
}
|
}
|
||||||
tabBarExtraContent = tabBarExtraContent === undefined && $slots.tabBarExtraContent
|
tabBarExtraContent = tabBarExtraContent === undefined && $slots.tabBarExtraContent
|
||||||
? h => h('span', [$slots.tabBarExtraContent])
|
? $slots.tabBarExtraContent : tabBarExtraContent
|
||||||
: tabBarExtraContent
|
tabBarExtraContent = typeof tabBarExtraContent === 'function'
|
||||||
|
? tabBarExtraContent(createElement) : tabBarExtraContent
|
||||||
$slots.default && $slots.default.forEach(({ componentOptions, key: tabKey }) => {
|
$slots.default && $slots.default.forEach(({ componentOptions, key: tabKey }) => {
|
||||||
if (componentOptions && componentOptions.propsData.tab === undefined) {
|
if (componentOptions && componentOptions.propsData.tab === undefined) {
|
||||||
componentOptions.propsData.tab = $slots[`tab_${tabKey}`]
|
componentOptions.propsData.tab = $slots[`tab_${tabKey}`]
|
||||||
? h => h('span', [$slots[`tab_${tabKey}`]])
|
? $slots[`tab_${tabKey}`]
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const tabBarProps = {
|
const tabBarProps = {
|
||||||
inkBarAnimated,
|
inkBarAnimated,
|
||||||
extraContent: tabBarExtraContent,
|
|
||||||
onTabClick,
|
onTabClick,
|
||||||
onPrevClick,
|
onPrevClick,
|
||||||
onNextClick,
|
onNextClick,
|
||||||
|
@ -152,6 +152,9 @@ export default {
|
||||||
{...tabsProps}
|
{...tabsProps}
|
||||||
>
|
>
|
||||||
{this.$slots.default}
|
{this.$slots.default}
|
||||||
|
{tabBarExtraContent ? <template slot='tabBarExtraContent'>
|
||||||
|
{tabBarExtraContent}
|
||||||
|
</template> : null}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue