antd-input
對antd的Input/TextArea進行一層封裝,限制使用者輸入長度,并實時顯示使用者輸入的長度,可以單獨使用,也可以結合表單一起使用,LimitInput屬性與antd的Input完全保持一緻,暫時沒有自身獨特的屬性;LimitTextArea隻有一個額外屬性sep,表示分割符,可以是個字元串,如:',',也可以是個正規表達式,如:/\n\r/,預設為''
React antd-input
install
npm i antd-input
Usage
例子
import React, { PureComponent, Fragment } from 'react'
import { LimitInput } from 'antd-input'
class LimitInputExample extends PureComponent {
state = {
val: ''
}
onChange = (e) => {
e.preventDefault()
this.setState({ val: e.target.value })
}
render() {
const style = {
width: '100%',
margin: '8px 0px',
textAlign: 'left',