# react-select-pinyin

> React 选择控件（支持拼音搜索）

Latest version **0.8.1** (published 2015-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-select-pinyin
pnpm add react-select-pinyin
yarn add react-select-pinyin
bun add react-select-pinyin
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.1 |
| Published | 2015-06-13 |
| First published | 2015-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 31 |
| Author | xcatliu |
| Maintainers | xcatliu |
| Keywords | react, react-component, select, pinyin, select-pinyin, react-select, react-pinyin, react-select-pinyin, multiselect, combobox, input, form, ui |

## Links

- npm: https://www.npmjs.com/package/react-select-pinyin
- Repository: https://github.com/xcatliu/react-select-pinyin
- Issues: https://github.com/xcatliu/react-select-pinyin/issues
- npm.io page: https://npm.io/package/react-select-pinyin

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^0.13.3
- [xtend](https://npm.io/package/xtend.md) ^4.0.0
- [pinyin](https://npm.io/package/pinyin.md) ^2.4.4
- [react-select](https://npm.io/package/react-select.md) ^0.4.9

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.8.1 (latest) — 2015-06-13
- 0.8.0 — 2015-06-13
- 0.7.0 — 2015-06-10
- 0.6.0 — 2015-06-10
- 0.5.0 — 2015-06-09
- 0.1.0 — 2015-05-15

## README

React 选择控件（支持拼音搜索）
===

[![Build Status](https://travis-ci.org/xcatliu/react-select-pinyin.svg?branch=master)](https://travis-ci.org/xcatliu/react-select-pinyin)

---

[JedWatson](https://github.com/JedWatson) 的 [react-select] 挺好用，但是不支持拼音搜索。

[react-select-pinyin] 基于 [react-select] 开发，添加了如下特性：

- 支持输入全拼匹配（如 beijingshi, beijing, beij, b 会匹配北京市）
- 支持输入首字母匹配（如 bjs, bj, b 会匹配北京市）
- 支持非开始位置的匹配（如 jingshi, ijins, eij 会匹配北京市）
- ***不支持***子串匹配（如 beishi ***不会***匹配北京市）

## Live Demo

[http://xcatliu.github.io/react-select-pinyin/](http://xcatliu.github.io/react-select-pinyin/)

## 使用方式

### CommonJS

若你的项目是基于 CommonJS 风格的，则直接 `require` 使用即可，具体的 api 和 [react-select] 一样：

```js
var Select = require('react-select-pinyin');

var options = [
  { value: '110100', label: '北京市' },
  { value: '120100', label: '天津市' }
];

function logChange(val) {
  console.log("选择了: " + val);
}

<Select
  name="form-field-name"
  value="one"
  options={options}
  onChange={logChange}
/>
```

默认的 css 在 `lib/default.css` 中，请按照你项目中插入 css 的方式自行取用。

### AMD

暂不支持

### 直接在 `script` 标签中引入

暂不支持

### 更多使用方式

更多使用方式请参考：[react-select#usage](https://github.com/JedWatson/react-select#usage)

## 开发

clone 之后，进入本项目，执行：

```shell
npm install
npm start
```

打开 [http://localhost:8000](http://localhost:8000) 查看示例。

编辑 `src` 和 `example` 进行开发。

## 发布新版本流程

1. 执行 `npm run lint` 执行 eslint 检查
2. 执行 `npm run prepublish` 将 `src` 中的 `jsx` 编译成 `lib` 中的 `js`，并且会复制 `react-select` 中的 css 到 `lib`
3. 执行 `npm version [<newversion> | major | minor | patch | prerelease | preminor | premajor ]` 升级版本号
4. 执行 `git push && git push --tags` 提交到 [GitHub](https://github.com/xcatliu/react-select-pinyin)
5. 执行 `npm publish` 发布到 [npmjs.com](https://www.npmjs.com/)
6. 执行 `npm run gh-pages` 更新 `gh-pages` 分支

[react-select]: https://github.com/JedWatson/react-select
[react-select-pinyin]: https://github.com/xcatliu/react-select-pinyin

---
_Source: https://npm.io/package/react-select-pinyin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
