0.0.4 • Published 3 years ago

fox-auto-width-input v0.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

介绍

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"

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago