2.0.2 • Published 6 months ago

react-input-for-chinese v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

react-input-for-chinese

中文输入时,文本框中会出现键入的拼音,并且会触发 input 的 onChange 回调,尽管此时 中文字尚未落入文本框。如果父组件需要在 onChange 时执行数据搜索的话,这可能会触发很 多无效搜索。所以这个组件的目的是为了在汉字落入文本框后才触发 onChange。

NPM JavaScript Style Guide

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

gif.gif

License

MIT ©

2.0.2

6 months ago

2.0.1

6 months ago

2.0.0

6 months ago

1.0.0

6 months ago