From 9a5a807c84fe0f9672ce01601fe9869c4954011b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 24 三月 2022 20:10:45 +0800 Subject: [PATCH] 2022-03-24 --- src/tabviews/custom/components/tabs/antv-tabs/index.jsx | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx index 6e685ca..e098179 100644 --- a/src/tabviews/custom/components/tabs/antv-tabs/index.jsx +++ b/src/tabviews/custom/components/tabs/antv-tabs/index.jsx @@ -30,8 +30,14 @@ UNSAFE_componentWillMount () { const { config, bids } = this.props + let _tabs = fromJS(config).toJS() + + if (_tabs.setting.supModule) { + _tabs.subtabs = [] + } + this.setState({ - tabs: fromJS(config).toJS(), + tabs: _tabs, parentIds: config.parentIds || [], bids: bids ? bids : {} }) @@ -71,12 +77,12 @@ } if (tabs.setting.supModule === MenuID) { - if (!data || data[tabs.setting.controlField] === undefined) { + if (!data) { this.setState({ - tabs: {...tabs, subtabs: this.props.config.subtabs} + tabs: {...tabs, subtabs: []} }) } else { - let val = data[tabs.setting.controlField] + '' + let val = data[tabs.setting.controlField] === undefined ? '' : data[tabs.setting.controlField] + '' this.setState({ tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => { if (tab.controlVal === val) { @@ -119,6 +125,8 @@ const { mainSearch, BID } = this.props const { tabs, bids } = this.state + if (!tabs.subtabs.length) return null + return ( <div className={'menu-antv-tabs-wrap ' + tabs.setting.tabLabel} style={tabs.style}> <Tabs defaultActiveKey="1" tabBarStyle={{background: tabs.setting.backgroundColor || 'transparent'}} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> -- Gitblit v1.8.0