react-input-for-chinese
v2.0.2
Published
Made with create-react-library
Downloads
2
Readme
react-input-for-chinese
中文输入时,文本框中会出现键入的拼音,并且会触发 input 的 onChange 回调,尽管此时 中文字尚未落入文本框。如果父组件需要在 onChange 时执行数据搜索的话,这可能会触发很 多无效搜索。所以这个组件的目的是为了在汉字落入文本框后才触发 onChange。
Install
npm install --save react-input-for-chinese
Usage
import React, { useState } from "react";
import InputOnTextChange from 'react-input-for-chinese'
import 'react-input-for-chinese/dist/index.css'
const App = () => {
const [text, setText] = useState('');
const handleChange = (v) => setText(v);
return (
<>
<InputOnTextChange value={text} onChange={handleChange} />
{text}
</>
)
}
export default App