1234567891011121314151617181920212223242526272829 |
- import React, { useState, useCallback } from 'react'
- import { Modal, Input, Icon } from 'antd'
-
- // 模拟浏览器 prompt
- export default props => {
- const [value, setValue] = useState()
- const handleValue = useCallback(
- e => setValue(e.target.value),
- [],
- )
-
- const handleOk = () => {
- if (props.onOk) {
- return props.onOk(value)
- }
- }
-
- return (
- <Modal
- {...props}
- destroyOnClose
- closable={false}
- maskClosable={false}
- onOk={handleOk}
- >
- <Input value={value} onChange={handleValue} />
- </Modal>
- )
- }
|