From c34bcb0a3054bdab29fbaff17e587c19d7b5de28 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 16 九月 2020 23:39:28 +0800 Subject: [PATCH] 2020-09-16 --- src/menu/components/tabs/antv-tabs/index.jsx | 32 ++++++++++++++------------------ 1 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index d9c0ec0..4c572a4 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -3,6 +3,7 @@ import { is, fromJS } from 'immutable' import { Tabs, Icon, Popover, Modal } from 'antd' +import MKEmitter from '@/utils/events.js' import asyncComponent from '@/utils/asyncComponent' import Utils from '@/utils/utils.js' @@ -41,22 +42,11 @@ floor: tabs.floor, subtype: tabs.subtype, setting: {span: 12, position: 'top', tabStyle: 'line', name: tabs.name}, - subtabs: [{ - uuid: Utils.getuuid(), - label: 'Tab 1', - icon: '', - components: [], - }, { - uuid: Utils.getuuid(), - label: 'Tab 2', - icon: '', - components: [], - }, { - uuid: Utils.getuuid(), - label: 'Tab 3', - icon: '', - components: [], - }] + subtabs: [ + { uuid: Utils.getuuid(), label: 'Tab 1', icon: '', components: [] }, + { uuid: Utils.getuuid(), label: 'Tab 2', icon: '', components: [] }, + { uuid: Utils.getuuid(), label: 'Tab 3', icon: '', components: [] } + ] } this.setState({ tabs: _tabs @@ -74,6 +64,13 @@ } updateComponent = (component) => { + const { tabs } = this.state + + if (!is(fromJS(tabs.setting), fromJS(component.setting))) { + // 娉ㄥ唽浜嬩欢-鏍囩鍙樺寲锛岄�氱煡鏍囩鍐呭厓绱� + MKEmitter.emit('tabsChange', tabs.uuid) + } + this.setState({ tabs: component }) @@ -191,8 +188,7 @@ <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span> </Popover> } key={tab.uuid}> - {/* Content of Tab Pane {tab.label} */} - <TabComponents menu={menu} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> + <TabComponents menu={menu} parentId={tabs.uuid} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> </TabPane> ))} <TabPane className="tab-add" disabled tab={<Icon onClick={this.tabAdd} type="plus" />} key="add"></TabPane> -- Gitblit v1.8.0