chore: tab 里面直接写 type, 虽然是一种不推荐的用法,但是还是兼容一下 (#2256)

This commit is contained in:
liaoxuezhi 2021-07-09 20:37:39 +08:00 committed by GitHub
parent 3b477cda35
commit a90bb85c6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -389,7 +389,8 @@ export default class Form extends React.Component<FormProps, object> {
'formInited', 'formInited',
'simpleMode', 'simpleMode',
'inputOnly', 'inputOnly',
'value' 'value',
'actions'
]; ];
hooks: { hooks: {

View File

@ -484,7 +484,7 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
> >
{render( {render(
`item/${index}/${tabIndex}`, `item/${index}/${tabIndex}`,
tab.tab || tab.body || '', (tab as any)?.type ? (tab as any) : tab.tab || tab.body,
{ {
data: ctx, data: ctx,
formMode: tab.mode || subFormMode || formMode, formMode: tab.mode || subFormMode || formMode,
@ -519,11 +519,15 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
? this.renderTab(tab, this.props, index) ? this.renderTab(tab, this.props, index)
: tabRender : tabRender
? tabRender(tab, this.props, index) ? tabRender(tab, this.props, index)
: render(`tab/${index}`, tab.tab || tab.body || '', { : render(
formMode: tab.mode || subFormMode || formMode, `tab/${index}`,
formHorizontal: (tab as any)?.type ? (tab as any) : tab.tab || tab.body,
tab.horizontal || subFormHorizontal || formHorizontal {
})} formMode: tab.mode || subFormMode || formMode,
formHorizontal:
tab.horizontal || subFormHorizontal || formHorizontal
}
)}
</Tab> </Tab>
) : null ) : null
); );