addTextS.tsx 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { Input, Modal, message } from "antd"
  2. import React, { useState } from "react"
  3. interface Props {
  4. title?: string
  5. visible?: boolean
  6. onClose?: () => void
  7. onChange?: (value: string) => void
  8. }
  9. /**
  10. * 批量添加文案
  11. * @returns
  12. */
  13. const AddTextS: React.FC<Props> = ({ title, visible, onClose, onChange }) => {
  14. /*****************************************/
  15. const [text, setText] = useState<string>()
  16. /*****************************************/
  17. const handleOk = () => {
  18. if (text) {
  19. onChange?.(text)
  20. } else
  21. message.error('请输入')
  22. }
  23. return <Modal
  24. title={<strong>批量添加{title || '文案'}</strong>}
  25. visible={visible}
  26. onCancel={onClose}
  27. onOk={handleOk}
  28. className={`modalResetCss`}
  29. width={650}
  30. >
  31. <Input.TextArea
  32. placeholder={`请输入${title || '文案'},多个换行`}
  33. value={text}
  34. onChange={(e) => setText(e.target.value)}
  35. allowClear
  36. rows={10}
  37. />
  38. </Modal>
  39. }
  40. export default React.memo(AddTextS)