model.jsx 760 B

12345678910111213141516171819202122232425262728293031
  1. import { Input, Modal } from 'antd';
  2. import { useRef, useState } from 'react';
  3. const AddFileModal = ({ id, visible, handleOk, handleCancel }) => {
  4. const [value, setValue] = useState('新建文件夹');
  5. const onChange = () => {
  6. console.log(value);
  7. handleOk?.({ id, dir_name: value });
  8. };
  9. return (
  10. <Modal
  11. title="新建文件夹"
  12. open={visible}
  13. onOk={onChange}
  14. onCancel={handleCancel}
  15. destroyOnClose
  16. >
  17. <div
  18. style={{ display: 'flex', whiteSpace: 'nowrap', alignItems: 'center' }}
  19. >
  20. 文件名:
  21. <Input
  22. defaultValue={'新建文件夹'}
  23. onChange={(e) => setValue(e.target.value)}
  24. />
  25. </div>
  26. </Modal>
  27. );
  28. };
  29. export default AddFileModal;