From 1c9bb11f933e67ad0d256311c6756b3f8419c2bb Mon Sep 17 00:00:00 2001 From: gingerlemon Date: Thu, 26 Oct 2023 15:26:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4=E8=A1=A8=E5=96=AE=20input=20?= =?UTF-8?q?change=20=E4=BA=8B=E4=BB=B6=E8=99=95=E7=90=86=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Edit/Edit.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/pages/Edit/Edit.js b/src/pages/Edit/Edit.js index c33adc1..04e7f0d 100644 --- a/src/pages/Edit/Edit.js +++ b/src/pages/Edit/Edit.js @@ -148,17 +148,20 @@ const Edit = () => { } // 資料事件處理器 - const handleChangeTitle = (e) => { - setNote({ ...note, title: e.target.value }) + const handleSetNote = (e) => { + setNote((prev) => ({ ...prev, [e.target.name]: e.target.value})) } + // const handleChangeTitle = (e) => { + // setNote({ ...note, title: e.target.value }) + // } - const handleChangeAuthor = (e) => { - setNote({ ...note, author: e.target.value }) - } + // const handleChangeAuthor = (e) => { + // setNote({ ...note, author: e.target.value }) + // } - const handleChangeTexts = (e) => { - setNote({ ...note, texts: e.target.value}) - } + // const handleChangeTexts = (e) => { + // setNote({ ...note, texts: e.target.value}) + // } const handleChangePassword = (e) => { // ^字串開頭|[]允許的字元集合規則|+複數字元|$字串結尾 @@ -185,29 +188,32 @@ const Edit = () => {
@@ -217,6 +223,7 @@ const Edit = () => {