https://github.com/future-team/ph-selector
ph选择器
https://github.com/future-team/ph-selector
Last synced: 19 days ago
JSON representation
ph选择器
- Host: GitHub
- URL: https://github.com/future-team/ph-selector
- Owner: future-team
- License: mit
- Created: 2016-08-02T02:14:14.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-12T10:43:35.000Z (almost 10 years ago)
- Last Synced: 2025-11-27T09:31:04.448Z (7 months ago)
- Language: JavaScript
- Size: 54.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ph-selector
一款类似城市选择器的组件,应用于移动端
## 使用
```js
import {Selector} from 'ph-selector';
import ReactDom from 'react/lib/ReactDOM';
ReactDom.render(
,
document.getElementById('root')
);
```
## API
```js
//数据请求地址
url:'/mocks/cities',
//是否本地缓存数据
isCache:true,
//缓存的id
cacheKey:'__searchList__',
//placeholder
placeholder:'请输入城市名查询',
//缓存过期时间
cacheExpire:24 * 3600,
//搜索按钮
submitButton:null,
//默认值
defaultValue:'',
//历史记录
historyKey:'__history_citys__',
//提交回调函数
successCallback: function(){},
searchCallback: function(){},
initCallback: function(){}
```
## 数据格式
请参考example/mocks/cities
## Command
```
#测试
npm run test
#打包
npm run build
#例子演示
npm run demo
```