import React, { Component } from 'react' import { Button, Tabs } from 'antd' import { ComponentDynamic, Container } from 'components' import { isEqual } from 'lodash' const tabs = [ { title: '标题', component: () => import('./tab'), show: true, }, ] export default class index extends Component { state = { actived: '0', loading: true, record: null, saving: false, } // 子表单实例集合 children = [] // 整合提交数据 formData = {} /** * 阻止外部组件引发的渲染,提升性能 * 可自行添加渲染条件 * [必要] * @param {*} props * @param {*} state * @returns */ shouldComponentUpdate(props, state) { return !isEqual(this.state, state) } /** * DOM加载完成钩子,可在此获取详细数据赋值到record */ componentDidMount() {} async onSubmit() { for (const child of this.children) { try { const data = await child.getData() this.formData = { ...this.formData, ...data, } } catch (e) { return e } } //#region 提交数据 this.setState({ saving: true }) this.setState({ saving: false }) //#endregion } render() { const { actived, loading, record, saving } = this.state return (