0.0.4 • Published 5 years ago
fox-auto-width-input
Licence
ISC
Version
0.0.4
Deps
2
Size
54 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated
介绍
fox-auto-width-input 根据字符自动计算input宽度
依赖
react >= 16.9
API
value?: string inputEl?: React.MutableRefObject inputChange?: (value:string,e:React.ChangeEvent)=>void inputDel?: (e:React.ChangeEvent)=>void inputEnter?: (e:React.ChangeEvent)=>void className?: string
| API | type | Desc |
|---|---|---|
| value | string | input value |
| inputEl | ref (useRef) | ref |
| inputChange | (value:string,e:React.ChangeEvent)=>void | input的onChang事件 |
| inputDel | (e:React.ChangeEvent)=>void | backspace事件 |
| inputEnter | (e:React.ChangeEvent)=>void | enter事件 |
| className | string | calssName |
demo
import {AutoWidthInput,useInputFocuse} from 'fox-auto-width-input'
const App = () => {
const [ inputEl, focusAutoWidthInput ] = useInputFocuse()
return (
<div className="content" onClick={focusAutoWidthInput}>
<AutoWidthInput
value={ 'qq' }
inputEl={ inputEl }
inputDel={ e => { console.log('inputdel', e) } }
inputEnter={ e => { console.log('inputenter', e) } }
inputChange={(value,e)=>{ console.log('inputChange',value,e) } }
/>
</div>
)
}
"webpack": "^4.44.1", "webpack-cli": "^3.3.12", "webpack-dev-server": "^3.11.0"