diff --git a/src/components/UserName/index.tsx b/src/components/UserName/index.tsx index 2f0d030..1bc10d7 100644 --- a/src/components/UserName/index.tsx +++ b/src/components/UserName/index.tsx @@ -5,13 +5,16 @@ import { Button, Input, message, Modal } from 'antd'; import { useState, useImperativeHandle, forwardRef } from "react"; const UserName = forwardRef((props: any, ref: any) => { useImperativeHandle(ref, () => ({ - changeModal: (str: string) => { - setUserName(str) + changeModal: (data: any) => { + setInfo(data) setUserNameModal(true) } })) const [userNameModal, setUserNameModal] = useState(false); - const [userName, setUserName] = useState(''); + const [info, setInfo] = useState({ + userName: '', + uid: '' + }); return ( <> { { - setUserName(e.target.value) + setInfo({ + ...info, + userName: e.target.value + }) }} /> @@ -40,12 +46,11 @@ const UserName = forwardRef((props: any, ref: any) => {