Skip to content

Commit 3a6e2f9

Browse files
author
undefined
committed
fix: add tabs listeners #189
1 parent bf161d4 commit 3a6e2f9

File tree

2 files changed

+8
-78
lines changed

2 files changed

+8
-78
lines changed

components/tabs/tabs.jsx

+6-75
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ export default {
8686
onPrevClick,
8787
onNextClick,
8888
animated,
89-
destroyInactiveTabPane = false,
90-
activeKey,
91-
defaultActiveKey,
92-
$slots,
9389
tabBarGutter,
9490
} = this
9591
const children = filterEmpty(this.$slots.default)
@@ -181,80 +177,15 @@ export default {
181177
children: childrenWithClose.length > 0 ? childrenWithClose : children,
182178
__propsSymbol__: Symbol(),
183179
},
180+
on: {
181+
...this.$listeners,
182+
change: this.handleChange,
183+
},
184+
class: cls,
184185
}
185186
return (
186-
<VcTabs
187-
{...tabsProps}
188-
class={cls}
189-
onChange={this.handleChange}
190-
/>
187+
<VcTabs {...tabsProps} />
191188
)
192-
// const tabBarExtraContent = getComponentFromProp(this, 'tabBarExtraContent')
193-
// const children = []
194-
// $slots.default && $slots.default.forEach((child) => {
195-
// if (isEmptyElement(child)) { return }
196-
// const { componentOptions } = child
197-
// const __ANT_TAB_PANE = getSlotOptions(child).__ANT_TAB_PANE
198-
// warning(__ANT_TAB_PANE, '`Tabs children just support TabPane')
199-
// if (componentOptions && __ANT_TAB_PANE) {
200-
// componentOptions.propsData = componentOptions.propsData || {}
201-
// if (componentOptions.propsData.tab === undefined) {
202-
// const tab = (componentOptions.children || []).filter(({ data = {}}) => data.slot === 'tab')
203-
// componentOptions.propsData.tab = tab
204-
// }
205-
// children.push(child)
206-
// }
207-
// })
208-
// const tabBarProps = {
209-
// props: {
210-
// hideAdd,
211-
// removeTab: this.removeTab,
212-
// createNewTab: this.createNewTab,
213-
// inkBarAnimated,
214-
// tabBarGutter,
215-
// },
216-
// on: {
217-
// tabClick: onTabClick,
218-
// prevClick: onPrevClick,
219-
// nextClick: onNextClick,
220-
// },
221-
// style: tabBarStyle,
222-
// }
223-
// const tabContentProps = {
224-
// props: {
225-
// animated: tabPaneAnimated,
226-
// animatedWithMargin: true,
227-
// },
228-
// }
229-
// const tabsProps = {
230-
// props: {
231-
// prefixCls,
232-
// tabBarPosition: tabPosition,
233-
// tabBarProps: tabBarProps,
234-
// tabContentProps: tabContentProps,
235-
// destroyInactiveTabPane,
236-
// defaultActiveKey,
237-
// type,
238-
// },
239-
// on: {
240-
// change: this.handleChange,
241-
// tabClick: this.onTabClick,
242-
// },
243-
// }
244-
// if (hasProp(this, 'activeKey')) {
245-
// tabsProps.props.activeKey = activeKey
246-
// }
247-
// return (
248-
// <Tabs
249-
// class={cls}
250-
// {...tabsProps}
251-
// >
252-
// {children}
253-
// {tabBarExtraContent ? <template slot='tabBarExtraContent'>
254-
// {tabBarExtraContent}
255-
// </template> : null}
256-
// </Tabs>
257-
// )
258189
},
259190
}
260191

components/vc-tabs/src/Tabs.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import omit from 'omit.js'
12
import BaseMixin from '../../_util/BaseMixin'
23
import PropTypes from '../../_util/vue-types'
34
import KeyCode from './KeyCode'
@@ -179,9 +180,7 @@ export default {
179180
contents.reverse()
180181
}
181182
return (
182-
<div
183-
class={cls}
184-
>
183+
<div {...{ on: omit(this.$listeners, ['change']), class: cls }}>
185184
{contents}
186185
</div>
187186
)

0 commit comments

Comments
 (0)