import React, { useState } from "react"; import { Switch, Form, Input, Space, Tag, InputNumber, Radio, Tooltip, } from 'antd'; import Styles from './web.module.less'; import EditorRegexs from "./editorRegexs"; export default function Password(props) { const { passport, t, changeEnabled, updateConfig } = props; const { id, type, enabled, stateColor } = passport; const config = passport.config || {}; const [min, setMin] = useState(config?.min || 8); const [max, setMax] = useState(config?.max || 24); const [regexs, setRegexs] = useState(config?.regexs || []); const [tip, setTip] = useState(config?.tip || ''); const [mode, setMode] = useState(config?.mode || 'all'); // useEffect(() => { // const newMin = config?.min || 8; // const newMax = config?.max || 24; // const newRegexs = config?.regexs || []; // const newTip = config?.tip || ''; // const newMode = config?.mode || 'all'; // if (min !== newMin) setMin(newMin); // if (max !== newMax) setMax(newMax); // if (JSON.stringify(regexs) !== JSON.stringify(newRegexs)) setRegexs(newRegexs); // if (tip !== newTip) setTip(newTip); // if (mode !== newMode) setMode(newMode); // }, [config?.min, config?.max, config?.regexs, config?.tip, config?.mode, config?.verify]); return (