Skip to content

Commit c1cd8f4

Browse files
committed
fix
1 parent 395df44 commit c1cd8f4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/tabs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Tabs from './tabs'
22
import TabPane from '../vc-tabs/src/TabPane'
33
import TabContent from '../vc-tabs/src/TabContent'
4-
Tabs.TabPane = { ...TabPane, name: 'ATabPane' }
4+
Tabs.TabPane = { ...TabPane, name: 'ATabPane', __ANT_TAB_PANE: true }
55
Tabs.TabContent = { ...TabContent, name: 'ATabContent' }
66
export default Tabs
77
export { TabPane, TabContent }

components/tabs/tabs.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
import Tabs from '../vc-tabs/src/Tabs'
33
import isFlexSupported from '../_util/isFlexSupported'
4-
import { hasProp, getComponentFromProp, getComponentName, isEmptyElement } from '../_util/props-util'
4+
import { hasProp, getComponentFromProp, getComponentName, isEmptyElement, getSlotOptions } from '../_util/props-util'
55
import warning from '../_util/warning'
66
export default {
77
name: 'ATabs',
@@ -112,9 +112,9 @@ export default {
112112
$slots.default && $slots.default.forEach((child) => {
113113
if (isEmptyElement(child)) { return }
114114
const { componentOptions } = child
115-
const componentName = getComponentName(componentOptions)
116-
warning(componentName === 'ATabPane', '`Tabs children just support TabPane')
117-
if (componentOptions && componentName === 'TabPane') {
115+
const __ANT_TAB_PANE = getSlotOptions(child).__ANT_TAB_PANE
116+
warning(__ANT_TAB_PANE, '`Tabs children just support TabPane')
117+
if (componentOptions && __ANT_TAB_PANE) {
118118
componentOptions.propsData = componentOptions.propsData || {}
119119
if (componentOptions.propsData.tab === undefined) {
120120
const tab = (componentOptions.children || []).filter(({ data = {}}) => data.slot === 'tab')

0 commit comments

Comments
 (0)