reacthooks获取input输⼊的值课程推荐
import React,{ uState ,uRef} from'react'
const VrCornucopiaHome = () => {
const [projectContent,tProjectContent] = uState()
const [projectContentNumber,tProjectContentNumber] = uState(0)
const dateVal = uRef()
const value = uRef()
return (
<div>
<input type="number" ref={dateVal} defaultValue={phoneNumber} placeholder='系统⾃动带出当前登录⼈电话' onChange= { (e) => {
value.current.value = dateVal.current.value //第⼀次⽅式
开心工作
e.target.value //第⼆种⽅式
}}></input>
<textarea defaultValue={projectContent} placeholder="请输⼊内容" onChange={ (e) => {关于花的词语
let str = e.target.value
汽车行业报告if(str.length <= 300){
tProjectContent(e.target.value)
奢侈品打折
tProjectContentNumber(str.length)
}
符号网名}}></textarea>
</div>
杂书
)
冠冕堂皇的拼音
}
export default VrCornucopiaHome