king
2020-09-16 c34bcb0a3054bdab29fbaff17e587c19d7b5de28
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>