修复了【其他配置】循环更新的问题

main
白封羽 2023-01-05 23:01:54 +08:00
parent d6230497c0
commit 02c9127c8f
1 changed files with 7 additions and 6 deletions

View File

@ -4,11 +4,12 @@ import {ActionType} from "@ant-design/pro-components";
import {FormInstance} from "antd/es/form"; import {FormInstance} from "antd/es/form";
import Column from "antd/es/table/Column"; import Column from "antd/es/table/Column";
import RedoOutlined from "@ant-design/icons/lib/icons/RedoOutlined"; import RedoOutlined from "@ant-design/icons/lib/icons/RedoOutlined";
class OtherConfig extends React.Component<any, any> { class OtherConfig extends React.Component<any, any> {
refresh = () => { refresh = () => {
//TODO: refresh //TODO: refresh
this.setState({forced: true, limit: 0}) this.setState({forced: true, limit: 0, activated: true})
} }
submit = () => { submit = () => {
//TODO: submit //TODO: submit
@ -27,7 +28,7 @@ class OtherConfig extends React.Component<any, any> {
} }
static getDerivedStateFromProps(props: any, state: any) { static getDerivedStateFromProps(props: any, state: any) {
if (props.activate !== state.activated && typeof state.refresh === "function") if (props.activate && props.activate !== state.activated && typeof state.refresh === "function")
state.refresh() state.refresh()
return {activated: props.activate}; return {activated: props.activate};
} }