export default function Address(props: { onChange?: (value: string) => void }) { const { onChange, ...rest } = props; const [area, setArea] = useState<Array>();

const handleOnChange = (value: string) => { if (onChange) { onChange(value); } };

return ( <Input addonBefore={ <Cascader style={{ width: 'auto', textAlign: 'left' }} options={dataAll} allowClear placeholder='请选择省市区/县' onChange={(value: Array) => setArea(value)} /> } onChange={(e: React.ChangeEvent) => handleOnChange(e.target.value)} {...rest} /> ); }

TypeScript 类型转换:将 any 转换为具体类型

原文地址: https://www.cveoy.top/t/topic/lHSn 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录