pull/165/head
tjz 7 years ago
parent 395df448c6
commit c1cd8f46f0

@ -1,7 +1,7 @@
import Tabs from './tabs' import Tabs from './tabs'
import TabPane from '../vc-tabs/src/TabPane' import TabPane from '../vc-tabs/src/TabPane'
import TabContent from '../vc-tabs/src/TabContent' import TabContent from '../vc-tabs/src/TabContent'
Tabs.TabPane = { ...TabPane, name: 'ATabPane' } Tabs.TabPane = { ...TabPane, name: 'ATabPane', __ANT_TAB_PANE: true }
Tabs.TabContent = { ...TabContent, name: 'ATabContent' } Tabs.TabContent = { ...TabContent, name: 'ATabContent' }
export default Tabs export default Tabs
export { TabPane, TabContent } export { TabPane, TabContent }

@ -1,7 +1,7 @@
import Tabs from '../vc-tabs/src/Tabs' import Tabs from '../vc-tabs/src/Tabs'
import isFlexSupported from '../_util/isFlexSupported' import isFlexSupported from '../_util/isFlexSupported'
import { hasProp, getComponentFromProp, getComponentName, isEmptyElement } from '../_util/props-util' import { hasProp, getComponentFromProp, getComponentName, isEmptyElement, getSlotOptions } from '../_util/props-util'
import warning from '../_util/warning' import warning from '../_util/warning'
export default { export default {
name: 'ATabs', name: 'ATabs',
@ -112,9 +112,9 @@ export default {
$slots.default && $slots.default.forEach((child) => { $slots.default && $slots.default.forEach((child) => {
if (isEmptyElement(child)) { return } if (isEmptyElement(child)) { return }
const { componentOptions } = child const { componentOptions } = child
const componentName = getComponentName(componentOptions) const __ANT_TAB_PANE = getSlotOptions(child).__ANT_TAB_PANE
warning(componentName === 'ATabPane', '`Tabs children just support TabPane') warning(__ANT_TAB_PANE, '`Tabs children just support TabPane')
if (componentOptions && componentName === 'TabPane') { if (componentOptions && __ANT_TAB_PANE) {
componentOptions.propsData = componentOptions.propsData || {} componentOptions.propsData = componentOptions.propsData || {}
if (componentOptions.propsData.tab === undefined) { if (componentOptions.propsData.tab === undefined) {
const tab = (componentOptions.children || []).filter(({ data = {}}) => data.slot === 'tab') const tab = (componentOptions.children || []).filter(({ data = {}}) => data.slot === 'tab')

Loading…
Cancel
Save