UNPKG

127 kBMarkdownView Raw
1# 简介
2SeedsUI,专为移动设备设计的UI框架,组件全面可换肤,以后将会有react版和vue版、h5版
3
4# 安装
5```js
6npm install seedsui-react --save
7```
8
9# 导入组件
10
11## 静态导入
12工程化项目
13```js
14import 'seedsui-react/build/seedsui.min.css';
15import {Chat} from 'seedsui-react';
16```
17HTML项目
18```css
19<link rel="stylesheet" href="https://unpkg.com/seedsui-react/build/seedsui.min.css">
20<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
21<script src="https://cdn.bootcss.com/react/16.4.0/umd/react.development.js"></script>
22<script src="https://cdn.bootcss.com/react-dom/16.4.0/umd/react-dom.development.js"></script>
23<script src="https://cdn.bootcss.com/babel-standalone/6.26.0/babel.min.js"></script>
24<script src="https://unpkg.com/seedsui-react/build/seedsui-react.min.js"></script>
25<script type="text/babel">
26 ReactDOM.render(
27 <seedsui.Chat>聊天框</seedsui.Chat>,
28 document.getElementById('root')
29 );
30</script>
31```
32## 动态导入
33用于工程化项目,建议使用动态导入, 以节省打包文件体积, 动态导入需要Less环境支持:
34```js
35npm install less less-loader --save-dev
36```
37修改 webpack.config.dev.js 和 webpack.config.prod.js 配置文件:<br>
38搜索“/\.css”,修改规则为/\.css|.less$/,use -> {loader: require.resolve('less-loader')}
39
40```js
41// 导入seedsui基础库
42import 'components/seedsui/index.less'; // 需要手动配置,见下节
43import 'seedsui-react/lib/PrototypeArray.js';
44import 'seedsui-react/lib/PrototypeMath.js';
45import 'seedsui-react/lib/PrototypeObject.js';
46import 'seedsui-react/lib/PrototypeString.js';
47import 'seedsui-react/lib/PrototypeDate.js';
48// 导入组件
49import Chat from 'seedsui-react/lib/Chat';
50```
51### index.less手动配置:
52#### 1.图标 src/components/seedsui/iconfont.less:<br>
53[下载模板](https://unpkg.com/seedsui-react/lib/seedsui-iconfont.less),放入src/components/seedsui/iconfont.less后修改
54<br><br>
55#### 2.变量 src/components/seedsui/variables.less:<br/>
56[下载模板](https://unpkg.com/seedsui-react/lib/seedsui-variables.less),放入src/components/seedsui/variables.less后修改
57<br><br>
58#### 3.组件 src/components/seedsui/components.less:<br/>
59[下载模板](https://unpkg.com/seedsui-react/lib/seedsui-components.less),放入src/components/seedsui/components.less后修改<br>
60引入地址修改如:
61```less
62@import "global/top/appearance.less";
63```
64前缀改为../../../node_modules/seedsui-react/lib/
65```less
66@import "../../../node_modules/seedsui-react/lib/global/top/appearance.less";
67```
68
69#### 三个less汇集 src/components/seedsui/index.less:
70```less
71// 图标
72// @import "../../../node_modules/seedsui-react/lib/seedsui-iconfont.less";
73@import "iconfont.less";
74// 变量,依赖图标(换肤文件)
75// @import "../../../node_modules/seedsui-react/lib/seedsui-variables.less";
76@import "variables.less";
77// 组件,依赖变量库
78// @import "../../../node_modules/seedsui-react/lib/seedsui-components.less";
79@import "components.less";
80```
81
82
83# 国际化
84[下载国际化文件](https://unpkg.com/seedsui-react/lib/lang.js), 修改window._seeds_lang对象即可
85
86
87# Component
88- [Actionsheet](#actionsheet) 卡片弹框
89- [Alert](#alert) 弹出框
90- [Badge](#badge) 徽章
91- [BiClock](#biclock) 时钟
92- [BiDoughnut](#bidoughnut) 环形图
93- [BiGauge](#bigauge) 导航
94- [Bridge](#bridge) 桥接
95- [Button](#button) 按钮
96- [Calendar](#calendar) 日历
97- [Card](#card) 卡片
98- [Carrousel](#carrousel) 轮播
99- [Chat](#chat) 聊天
100- [Checkbox](#checkbox) 复选框
101- [Container](#container) page主体
102- [Counter](#counter) 计数器
103- [Dialog](#dialog) 自定义弹出框
104- [Dot](#dot) 小点点
105- [Dragrefresh](#dragrefresh) 下拉刷新
106- [Dropdown](#dropdown) 页签菜单
107- [Emoji](#emoji) 表情
108- [Footer](#footer) page底部
109- [Grid](#grid) 栅格
110- [Group](#group) 分组
111- [Handsign](#handsign) 手写签名
112- [Header](#header) page头部
113- [ImgMark](#imgmark) 图片标注
114- [ImgLazy](#imglazy) 懒人加载
115- [IndexBar](#imguploader) 侧边索引栏
116- [InputArea](#inputarea) 多行文本框
117- [InputCity](#inputcity) 城市选择
118- [InputColor](#inputcolor) 颜色选择框
119- [InputDate](#inputdate) 日期选择
120- [InputLocation](#inputlocation) 定位
121- [InputNumber](#inputnumber) 数字输入框
122- [InputPassword](#inputpassword) 密码框
123- [InputPhone](#inputphone) 手机号码输入框
124- [InputPicker](#inputpicker) 滚动选择框
125- [InputPre](#inputpre) 自增高输入框
126- [InputRange](#inputrange) 范围选择框
127- [InputSafe](#inputsafe) 安全强度检验框
128- [InputSelect](#inputselect) 选择框
129- [InputStar](#inputstar) 评分框
130- [InputText](#inputtext) 文本框
131- [InputVerify](#inputverify) 验证码文本框
132- [Verify](#verify) 验证码文本框
133- [Jcrop](#jcrop) 图片裁切
134- [Legend](#legend) 标题
135- [List](#list) 列表
136- [ListPull](#listpull) 可推动列表
137- [Loading](#loading) 加载中
138- [LotteryWheel](#lotterywheel) 奖品轮播
139- [Mark](#mark) 标记
140- [Marquee](#marquee) 跑马灯
141- [MenuTiled](#menutiled) 平铺弹出菜单
142- [MenuTree](#menutree) 侧边树形菜单
143- [Notice](#notice) 公告
144- [NumBox](#numbox) 数字加减框
145- [NumBoxPop](#numboxpop) 数字加减弹出框
146- [NumBoxPopPointer](#numboxpoppointer) 数字加减指针
147- [OnOff](#onoff) 开关
148- [Page](#page) 页面
149- [PagePull](#pagepull) 可推动页面
150- [Peg](#peg) 小竖条
151- [Picker](#picker) 滚动选择弹框
152- [PickerCity](#pickercity) 城市选择弹框
153- [PickerDate](#pickerdate) 日期选择弹框
154- [Player](#player) 视频播放器
155- [Popover](#popover) 箭头弹框
156- [Progress](#progress) 进度条
157- [Radio](#radio) 单选框
158- [RouteComment](#routecomment) 评价路由
159- [SearchBoard](#searchboard) 搜索面板
160- [SelectPicker](#selectpicker) 选择弹框
161- [Star](#star) 星星
162- [Stencil](#stencil) 加载模板
163- [Sticker](#sticker) 标签贴
164- [Tabbar](#tabbar) 页签
165- [Ticket](#ticket) 票券
166- [Timeline](#timeline) 时间轴
167- [Timepart](#timepart) 时间段
168- [Titlebar](#titlebar) 标题栏
169- [Toast](#toast) 提示弹框
170- [Tree](#tree) 树结构
171- [Verify](#verify) 验证码文本框
172
173
174# Utils
175- [MapUtil](#maputil) 地图工具
176- [GeoUtil](#geoutil) 地理工具
177
178
179## Actionsheet
180[卡片框](https://unpkg.com/seedsui-react/src/lib/Actionsheet/Actionsheet.js)
181### 属性
182```javascript
183<Actionsheet
184 portal={传送dom object, 默认document.getElementById('root')}
185 show={*显隐 bool, 默认false}
186 duration={动画时长 number, 默认见seedsui-variables.less}
187
188 list={*按钮项 array, 如: [{caption: string}]}
189 onClick={点击项 func(e, item, index), 有此属性才显示确定按钮}
190
191 maskStyle={遮罩style object, 默认无}
192 maskClassName={遮罩className string, 默认无, 基础'mask actionsheet-mask'}
193 onClickMask={点击遮罩 func(e), 默认无}
194
195 style={容器style object, 默认无}
196 className={容器className string, 默认无, 基础'actionsheet'}
197
198 groupStyle={组style object, 默认无}
199 groupClassName={组className string, 默认无, 基础'actionsheet-group'}
200
201 optionStyle={项style object, 默认无}
202 optionClassName={项className string, 默认'border-b', 基础'actionsheet-option'}
203
204 cancelStyle={取消按钮style object, 默认无}
205 cancelClassName={取消按钮className string, 默认无, 基础'actionsheet-cancel'}
206 cancelCaption={取消按钮文字 node, 默认'取消'}
207 onClickCancel={点击取消按钮 func(e), 默认无, 有此属性才显示取消按钮}
208/>
209```
210### 示例
211```javascript
212import Actionsheet from 'seedsui-react/lib/Actionsheet';
213onClickActionsheet = (item, index) => {
214 console.log(item) // => {caption: '菜单1'}
215}
216<Actionsheet
217 show={this.state.actionsheetShow}
218 list={[{caption: '菜单1'}, {caption: '菜单2'}]}
219 onClick={this.onClickActionsheet}
220 onClickCancel={this.hideActionsheet}
221 onClickMask={this.hideActionsheet}/>
222```
223[返回目录](#component)
224
225
226## Alert
227[对话框](https://unpkg.com/seedsui-react/src/lib/Alert/Alert.js)
228### 建议
229Alert组件更适用于复杂的定制弹框,一般弹框建议直接使用Api直接调用:
230* alert框:Bridge.showAlert(msg)代替
231* confirm框:Bridge.showConfirm(msg, {onSuccess: fn, onError: fn})代替
232
233详见[Bridge 桥接库](#bridge) 桥接库
234
235### 属性
236```javascript
237<Alert
238 portal={传送dom object, 默认document.getElementById('root')}
239 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
240 show={*显隐 bool, 默认false}
241 duration={动画时长 number, 默认见seedsui-variables.less}
242
243 maskStyle={遮罩style object, 默认无}
244 maskClassName={遮罩className string, 默认无}
245 onClickMask={点击遮罩 func, 默认无}
246
247 style={容器style object, 默认无}
248 className={容器className string, 默认无}
249
250 caption={标题文字 node, 默认无}
251 captionStyle={标题style object, 默认无}
252 captionClassName={标题className string, 默认无}
253
254 icon={图标dom node, 默认无}
255
256 contentStyle={内容style object, 默认无}
257 contentClassName={内容className string, 默认无}
258 children={内容 node, 默认无}
259
260 submitStyle={确定按钮style object, 默认无}
261 submitClassName={确定按钮className string, 默认无}
262 submitCaption={确定按钮文字 node, 默认'确定'}
263 disabled={确定按钮是否禁用 bool, 默认false}
264 onClickSubmit={点击确定按钮 func(args), 有此属性才显示确定按钮}
265
266 cancelStyle={取消按钮style object, 默认无}
267 cancelClassName={取消按钮className string, 默认无}
268 cancelCaption={取消按钮文字 node, 默认'取消'}
269 onClickCancel={点击取消按钮 func(args), 默认无, 有此属性才显示取消按钮}
270/>
271```
272
273### 示例
274```javascript
275import Alert from 'seedsui-react/lib/Alert';
276<Alert
277 show={this.state.alertShow}
278 submitCaption="确定按钮"
279 onClickSubmit={this.onSubmitAlert}>
280 提示内容
281</Alert>
282```
283[返回目录](#component)
284
285
286
287
288
289
290
291## Badge
292[徽章](https://unpkg.com/seedsui-react/src/lib/Badge/Badge.js)
293### 属性
294```javascript
295<Badge
296 className={容器className string, 默认无, 基础'badge',内容大于两位时会加上'badge-max-width'}
297 style={容器style object, 默认无}
298 limit={位数限制 number, 默认2, 如:1000,将显示99+}
299 ellipsis={位数限制省略号 string, 默认'+'}
300 {...others}
301/>
302```
303### 示例
304```javascript
305import Actionsheet from 'seedsui-react/lib/Actionsheet';
306
307const BadgeStyle = {
308 position: 'absolute',
309 left: '13px',
310 top: '-5px',
311};
312
313<Icon className="icon-cart">
314 {cartCount > 0 && <Badge style={BadgeStyle}>{cartCount}</Badge>}
315</Icon>
316```
317[返回目录](#component)
318
319
320
321
322## BiClock
323[时钟](https://unpkg.com/seedsui-react/src/lib/BiClock/BiClock.js)
324### 属性
325```javascript
326<BiClock
327 lineWidth={边框宽度px number, 默认2}
328 size={宽高大小px number, 默认50}
329 time={时间 string, 默认'00:00'} // 格式 hh:mm
330 className={容器className string, 默认无, 基础'bi-clock'}
331 style={容器style object, 默认无}
332
333 duration={动画时长 number, 默认1000}
334 delay={延时 number, 默认100}
335/>
336```
337### 示例
338```javascript
339import BiClock from 'seedsui-react/lib/BiClock';
340
341<BiClock time="11:30"/>
342```
343[返回目录](#component)
344
345
346
347## BiDoughnut
348[环形图](https://unpkg.com/seedsui-react/src/lib/BiDoughnut/BiDoughnut.js)
349### 属性
350```javascript
351<BiDoughnut
352 lineWidth={边框宽度px number, 默认3}
353 size={宽高大小px number, 默认50}
354 duration={动画时长 number, 默认1000}
355 rotate={旋转角度 number, 默认0, 最大360}
356 delay={延时 number, 默认100}
357
358 className={容器className string, 默认无, 基础'bi-doughtut'}
359 captionClassName={标题className string, 默认无, 基础'bi-doughtut-caption'}
360 captionStyle={标题style object, 默认无}
361>
362标题内容
363<BiDoughnut>
364```
365### 示例
366```javascript
367import BiDoughnut from 'seedsui-react/lib/BiDoughnut';
368
369<BiDoughnut rotate={15} className="success">
370 待审批
371</BiDoughnut>
372<BiDoughnut rotate={45} className="warn">
373 准备中
374</BiDoughnut>
375<BiDoughnut rotate={315} className="submit">
376 进行中
377</BiDoughnut>
378<BiDoughnut rotate={360} className="disabled">
379 已结束
380</BiDoughnut>
381<BiDoughnut rotate={120} className="cancel">
382 已取消
383</BiDoughnut>
384```
385[返回目录](#component)
386
387
388
389
390## BiGauge
391[仪表盘](https://unpkg.com/seedsui-react/src/lib/BiGauge/BiGauge.js)
392### 属性
393```javascript
394<BiGauge
395 duration={动画时长 number, 默认1000}
396 rotate={旋转角度 number, 默认0, 最大270}
397 delay={延时 number, 默认100}
398
399 className={容器className string, 默认无, 基础'bi-gauge-box'}
400 style={容器style object, 默认无}
401 captionClassName={标题className string, 默认无, 基础'bi-gauge-caption'}
402 captionStyle={标题style object, 默认无}
403>
404标题内容
405<BiGauge>
406```
407### 示例
408```javascript
409import BiGauge from 'seedsui-react/lib/BiGauge';
410
411<BiGauge rotate={15} className="success">
412 15
413</BiGauge>
414```
415[返回目录](#component)
416
417
418
419
420## Bridge
421[桥接](https://unpkg.com/seedsui-react/src/lib/Bridge/index.js)
422, 现支持四个平台的桥接适配, 浏览器、订货、外勤、微信客户端
423### 对象
424```javascript
425Bridge:{
426 platform: 'browser', // 根据不同的环境将返回不同的结果 'browser' | 'dinghuo' | 'waiqin' | 'weixin'
427 debug: false, // 在浏览器中,为true时将会启动调试模式,会使用假数据
428 config: fn, // Bridge.config(); 在应用初始化时需要执行此方法, 连接桥接
429 getAppVersion: fn, // 获取版本信息
430 chooseImage: fn({
431 count: number,
432 sizeType: ['original', 'compressed'],
433 sourceType: ['album', 'camera'],
434 success: fn({sourceType: 'camera | album', errMsg: 'chooseImage:ok', localIds: array}),
435 fail: fn({code: number, errMsg: 'chooseImage:fail'})
436 }),
437 uploadImage: fn({
438 success: fn({mediaUrl: string, errMsg: 'uploadImage:ok', serverId: '1237378768e7q8e7r8qwesafdasdfasdfaxss111'}),
439 }),
440 previewImage: fn({
441 urls:'需要预览的图片http链接列表',
442 current:'当前显示图片的http链接'
443 }),
444 getContactMore: fn({ // 外勤客户端专用, 人员插件多选
445 selectedIds: '5330457627710680963,5330457627710680963',
446 aclType: '0', // 人员权限, 0只能看到下属, 不传或者其他的参数为全部人员, 默认为空串
447 onSuccess: fn([{
448 "id": "5330457627710680963",
449 "name": "张三"
450 }])
451 }),
452 getContact: fn({ // 外勤客户端专用, 人员插件单选
453 id: '5330457627710680963',
454 aclType: '0', // 人员权限, 0只能看到下属, 不传或者其他的参数为全部人员, 默认为空串
455 onSuccess: fn({
456 "id": "5330457627710680963",
457 "name": "张三"
458 })
459 }),
460 getCustomerMore: fn({ // 外勤客户端专用, 客户插件多选
461 selectedIds: '5330457627710680963,5330457627710680963',
462 tradeType: '1', // 1:客户 2:经销商 3:门店 空串:全部, 默认为空串
463 hiddenAdd: true, // 是否隐藏添加按钮, 默认true
464 onSuccess: fn([{
465 "check": true,
466 "distance": 31,
467 "labelType": 0,
468 "addr": "南京市建邺区康文路康缘智汇港附近",
469 "approval_status": "3",
470 "code": "20180403004",
471 "cooperate_status": "1",
472 "district_id": "",
473 "id": "5330457627710680963",
474 "lat": "",
475 "location": "31.983362,118.73069",
476 "lon": "",
477 "manager_name": "",
478 "name": "20180403003",
479 "name_py": "20180403004 20180403004",
480 "trade_type": "3",
481 "type_id": "",
482 "type_image": ""
483 }])
484 }),
485 getCustomer: fn({ // 外勤客户端专用, 客户插件单选
486 id: '5330457627710680963',
487 tradeType: '1', // 1:客户 2:经销商 3:门店 空串:全部, 默认为空串
488 hiddenAdd: true, // 是否隐藏添加按钮, 默认true
489 onSuccess: fn({
490 "check": true,
491 "distance": 31,
492 "labelType": 0,
493 "addr": "南京市建邺区康文路康缘智汇港附近",
494 "approval_status": "3",
495 "code": "20180403004",
496 "cooperate_status": "1",
497 "district_id": "",
498 "id": "5330457627710680963",
499 "lat": "",
500 "location": "31.983362,118.73069",
501 "lon": "",
502 "manager_name": "",
503 "name": "20180403003",
504 "name_py": "20180403004 20180403004",
505 "trade_type": "3",
506 "type_id": "",
507 "type_image": ""
508 })
509 }),
510 getCustomerType: fn({ // 外勤客户端专用, 客户插件, 客户类型选择
511 id: '5330457627710680963',
512 name: '类型1',
513 tradeType: '1', // 1:客户 2:经销商 3:门店 其它为客户, 默认为空串
514 onSuccess: fn([{
515 "id": "5330457627710680963",
516 "name": "类型1"
517 }])
518 }),
519 getCustomerArea: fn({ // 外勤客户端专用, 客户插件, 客户区域选择
520 id: '5330457627710680963',
521 name: '区域1',
522 onSuccess: fn([{
523 "id": "5330457627710680963",
524 "name": "区域1"
525 }])
526 }),
527 getDepartmentMore: fn({ // 外勤客户端专用, 部门插件, 部门多选
528 selectedIds: '5330457627710680963,5330457627710680963',
529 onSuccess: fn([{
530 "id": "5330457627710680963",
531 "name": "市场部"
532 }])
533 }),
534 getDepartment: fn({ // 外勤客户端专用, 部门插件, 部门单选
535 id: '5330457627710680963',
536 name: '市场部',
537 onSuccess: fn([{
538 "id": "5330457627710680963",
539 "name": "市场部"
540 }])
541 }),
542 openWindow: fn( // 打开新窗口
543 {
544 url: string, // 打开的地址
545 title: '', // 外勤客户端专用, 标题, 默认为空串
546 },
547 fn() // 外勤客户端专用, 打开回调
548 ),
549 closeWindow: fn( // 关闭窗口, 客户端关闭窗口, 浏览器和微信go(-1)
550 fn() // 订货客户端专用, 关闭回调
551 ),
552 goHome: fn(
553 fn() // 外勤客户端专用, 回到首页回调
554 )
555 isHomePage: fn(
556 fn(true | false), // 是否是首页回调
557 rule: '地址栏包含的字符串' // 用于判断是不是首页
558 ),
559 back: fn(), // 返回, 地址栏参数isFromApp: home(调用goHome) | confirm(对话框后go(-1)) | confirm-close(对话框后调用closeWindow) | 1(go(-1))
560 addBackPress: fn(), // 绑定返回按键监听back方法
561 removeBackPress: fn(), // 移除返回按键监听
562 getLocation: fn({ // 定位, 默认为gcj02坐标
563 onSuccess: fn({longitude:'118.730515', latitude:'31.982473', speed:'0.0', accuracy:'3.0.0'}),
564 onError: fn({code:'locationFail', msg: '定位功能仅可在微信或APP中使用'})
565 }),
566 getAddress: fn({ // 地址逆解析
567 latitude: '',
568 longitude: '',
569 onSuccess: fn('地址'),
570 onError: fn({code: 'addressFail', msg: '获取位置名称失败,请稍后重试'})
571 }),
572 getDistance: fn({ // 获取两点间的距离,返回km
573 point1: {longitude: '', latitude: ''},
574 point2: {longitude: '', latitude: ''},
575 onError: fn({code: 'distanceFail', msg: '传入的坐标不正确'})
576 }),
577 getWeather: fn({ // 获得天气
578 location: 'lng,lat|lng,lat|lng,lat', // 可以用坐标或者地名, 如:'北京市|上海市', 用|隔开返回结果集
579 onSuccess: fn([{
580 currentCity: "北京市",
581 index: [
582 {
583 des: "建议着长袖T恤、衬衫加单裤等服装。年老体弱者宜着针织长袖衬衫、马甲和长裤。",
584 tipt: "穿衣指数",
585 title: "穿衣",
586 zs: "舒适"
587 }
588 ...
589 ],
590 pm25: "48",
591 weather_data: [
592 {
593 date: "周二 09月25日 (实时:20℃)",
594 dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",
595 nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",
596 temperature: "22 ~ 12℃",
597 weather: "多云",
598 wind: "南风3-4级"
599 },{
600 date: "周三",
601 dayPictureUrl: "http://api.map.baidu.com/images/weather/day/duoyun.png",
602 nightPictureUrl: "http://api.map.baidu.com/images/weather/night/duoyun.png",
603 temperature: "24 ~ 14℃",
604 weather: "多云",
605 wind: "南风微风"
606 }
607 ]
608 }]),
609 onFail: fn({code: 'weatherFail', msg: '获取天气失败,请稍后重试'})
610 }),
611 scanQRCode: fn({
612 needResult: 1, // 微信专用, 默认为1,0扫描结果由微信处理,1则直接返回扫描结果
613 scanType: ['qrCode', 'barCode'], // 微信专用, 扫码类型
614 onSuccess: fn({resultStr: ''}),
615 onError: fn({code: 'qrcodeFail', msg: '扫码失败,请退出重试' + res})
616 }),
617 logOut: fn(), // 外勤和订货客户端专用, 退出到登录页面
618 Image: { // 照片选择上传
619 onChooseSuccess: fn ({ // 选择完成, 出参为imgMap
620 localId: {
621 serverId: '',
622 sourceType: 'camera | album',
623 name: '', // 外勤客户端专用
624 base64: '', // 外勤客户端专用
625 src: '' //外勤客户端专用, 本地地址
626 }
627 }),
628 onUploadSuccess:fn(imgMap,res) // 微信专用, 单张上传成功
629 onUploadFail:fn(index, item) // 微信专用, 单张上传失败
630 onUploadsSuccess:fn(imgMap) // 微信专用, 全部上传成功
631 },
632 logger: fn(el), // 打印日志, el监听触发的元素, 点击十次显示, 用DB.setSession('app_logger', '')设置日志
633 tel: fn('13800000000'), // 打电话
634 showToast: fn('消息内容', {
635 mask: true, // true下层事件会被阻止,false则不阻止
636 position: 'middle', // 弹框位置, top | middle | bottom
637 icon: 'icon-xx', // 图标class名称
638 delay: 2000, // 延时关闭
639 onSuccess: fn() // 完成关闭时回调
640 }),
641 showLoading: fn({ // 弹出loading
642 type: 'floating流光 | filling填料环 | custom自定义',
643 css: '', // 设置mask的css
644 icon: 'icon-xx', // 自定义loading时,图标class名称
645 mask: true, // true下层事件会被阻止,false则不阻止
646 }),
647 hideLoading: fn() // 隐藏loading
648 showAlert: fn('消息内容', {
649 caption: '', // 标题, 默认为空串
650 onSuccess: fn({hide: fn()}) // 点击确定时回调, 默认为隐藏弹出框
651 }),
652 showConfirm: fn('消息内容', {
653 caption: '', // 标题, 默认为空串
654 onSuccess: fn({hide: fn()}), // 点击确定时回调
655 onError: fn() // 点击取消时回调, 默认为隐藏弹出框
656 })
657}
658```
659### 示例
660```javascript
661import Bridge from 'seedsui-react/lib/Bridge';
662
663Bridge.showToast('提交成功', {
664 mask: true,
665 onSuccess: () => {
666 history.go(-1);
667 }
668});
669```
670[返回目录](#component)
671
672
673
674
675## Button
676[按钮](https://unpkg.com/seedsui-react/src/lib/Button/Button.js)
677### 属性
678```javascript
679<Button
680 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
681 style={按钮style object, 默认无}
682 className={按钮className string, 默认无, 基础'button'} // 尺寸样式'sm | lg | xl'
683 disabled={是否禁用 bool, 默认false}
684 onClick={点击项 func(args)}
685 {...others}
686>
687 按钮内容
688</Button>
689```
690### 示例
691```javascript
692import Button from 'seedsui-react/lib/Button';
693
694<Button className="lg">提交</Button>
695```
696[返回目录](#component)
697
698
699
700
701## Calendar
702[日历](https://unpkg.com/seedsui-react/src/lib/Calendar/Calendar.js)
703### 属性
704```javascript
705<Calendar
706 type={日历类型 string, 默认'month'} // week|month
707 titleFormat={是否显示周数 string, 默认'YYYY年MM月DD日'} // 标题日期格式化 YYYY年MM月DD日 周E 第W周
708 disableBeforeDate={禁用此前日期 date, 默认无}
709 disableAfterDate={禁用此后日期 date, 默认无}
710 verticalDrag={是否允许垂直拖动 bool, 默认true}
711 defaultDate={默认选中日期 date, 默认new Date()}
712 prevHTML={左箭头html string, 默认'&lt'}
713 nextHTML={右箭头html string, 默认'&gt'}
714 onChange={选中日期发生变化 func(date)}
715 onClick={点击 func(date)}
716 onError={非法操作,如选择禁用日期 func(date)}
717/>
718```
719### 示例
720```javascript
721import Calendar from 'seedsui-react/lib/Calendar';
722
723onChangeCalendar = (s) => {
724 // 记录滑动后切换的日期
725 console.log('滑动选中:' + s.activeDate.format('YYYY-MM-DD'))
726}
727onClickCalendar = (s) => {
728 // 记录点击的选中日期, 用于滑动不切换日期用
729 console.log('点击选中:' + s.selectedDate.format('YYYY-MM-DD'))
730}
731showMonth = () => {
732 this.$calendar.instance.showMonth();
733}
734showWeek = () => {
735 this.$calendar.instance.showWeek();
736}
737showToday = () => {
738 this.$calendar.instance.setToday();
739}
740showReset = () => {
741 this.$calendar.instance.setDefaultDate();
742}
743
744const defaultDate = new Date()
745defaultDate.nextMonth();
746
747<Calendar
748 ref={el => {this.$calendar = el;}}
749 type="week"
750 titleFormat="YYYY年MM月DD日 周EE 第W周"
751 disableBeforeDate={new Date()}
752 onChange={this.onChangeCalendar}
753 onClick={this.onClickCalendar}
754 defaultDate={defaultDate}
755/>
756<a style={{margin: '8px'}} className="button lg bg-1" onClick={this.showMonth}>月</a>
757<a style={{margin: '8px'}} className="button lg bg-2" onClick={this.showWeek}>周</a>
758<a style={{margin: '8px'}} className="button lg bg-3" onClick={this.showToday}>今天</a>
759<a style={{margin: '8px'}} className="button lg bg-4" onClick={this.showReset}>重置</a>
760```
761[返回目录](#component)
762
763
764
765
766## Card
767[卡片](https://unpkg.com/seedsui-react/src/lib/Card/Card.js)
768### 属性
769```javascript
770<Card
771 style={卡片style object, 默认无}
772 className={卡片className string, 默认无, 基础'card'}
773 onClick={点击项 func(args)}
774 {...others}
775>
776卡片内容
777</Card>
778```
779### 示例
780```javascript
781import Card from 'seedsui-react/lib/Card';
782
783<Card>
784卡片内容
785</Card>
786```
787[返回目录](#component)
788
789
790
791
792## Carrousel
793[轮播](https://unpkg.com/seedsui-react/src/lib/Carrousel/Carrousel.js)
794### 属性
795```javascript
796<Carrousel
797 style={容器style object, 默认无}
798 className={容器className string, 默认无, 基础:list模式下为'carrousel-container'|page模式下为'carrousel-page'}
799
800 slideParams={div左线条属性 object, 默认无, 基础{className: 'carrousel-slide'}}
801
802 pagination={是否显示小点点 bool | node, 默认false} // 传node为自定义分页
803 paginationParams={div小点点容器属性 object, 默认无, 基础{className: 'carrousel-pagination'}}
804
805 stopPropagation={是否阻止点击事件的传播 bool, 默认false} // 当touch事件与FastClick插件冲突时可设为false
806 loop={是否循环显示 bool, 默认false}
807 activeIndex={默认选中第几块 number, 默认0}
808
809 autoplay={自动播放毫秒数 number, 默认0} // 设置大于0的数值才会触发自动播放
810 slidesPerView={一屏显示几块 number, 默认1}
811 defaultSrc={默认图片 string, 默认'//res.waiqin365.com/d/seedsui/carrousel/default.png'}
812 list={轮播图 array, 默认无} // 格式: [{bg: 'xx', img: 'xx', iconParams: {}, caption: 'xx'}]
813 speed={动画过渡的速度 number, 默认300}
814 enableOnChange={手动调用slideTo方法是否触发onChange事件回调 bool, 默认true}
815 onChange={轮播时事件回调 func()}
816 onClick={点击块 func(item, index, s, e)}
817
818 children={wrapper容器内子元素 node, 默认无}
819
820 {...others}
821>
822<div>轮播页时, 用此div, 轮播图则使用list属性</div>
823</Carrousel>
824```
825### 示例
826```javascript
827import Calendar from 'seedsui-react/lib/Calendar';
828// 轮播页
829onCarrouselChange = (e) => {
830 this.props.changeActiveTab(e.activeIndex);
831 if (e.activeIndex === 1) { // 加载第二页内容
832 if (!this.sndLoaded) {
833 this.loadSnd(false);
834 this.sndLoaded = true;
835 }
836 }
837}
838<Carrousel style={{top: '84px'}} onChange={this.onCarrouselChange} activeIndex={this.props.tabActiveIndex}>
839 <Page>第一页</Page>
840 <Page>第二页</Page>
841</Carrousel>
842// 轮播图
843<Carrousel list={imgsList} style={{height: document.getElementById('root').clientWidth + 'px'}} pagination loop/>
844```
845[返回目录](#component)
846
847
848
849
850## Chat
851[聊天框](https://unpkg.com/seedsui-react/src/lib/Chat/Chat.js)
852### 属性
853```javascript
854<Chat
855 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
856 style={容器style object, 默认无}
857 className={容器className string, 默认无, 基础'chat'}
858 onClick={点击聊天框 func()}
859
860 showAvatar={是否显示照片 bool, 默认false}
861 avatarClassName={照片className string, 默认'chat-avatar'}
862 avatarStyle={照片style object, 默认无}
863 avatarSrc={照片src string, 默认无}
864 avatarAfter={照片后元素 node, 默认无}
865 onClickAvatar={点击照片 func()}
866
867 author={用户名称 string, 默认无}
868 authorClassName={用户名称className string, 默认无, 基础'chat-author'}
869 authorStyle={用户名称style object, 默认无}
870
871 contentClassName={内容className string, 默认无, 基础'chat-content'}
872 contentStyle={内容style object, 默认无}
873 onClickContent={点击内容 func()}
874>
875内容
876</Chat>
877```
878### 示例
879```javascript
880import Chat from 'seedsui-react/lib/Chat';
881
882<Chat>
883内容
884</Chat>
885```
886[返回目录](#component)
887
888
889
890
891## Checkbox
892[复选框](https://unpkg.com/seedsui-react/src/lib/Checkbox/Checkbox.js)
893### 属性
894```javascript
895<Checkbox
896 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
897 style={容器style object, 默认无}
898 className={容器className string, 默认无, 基础'checkbox-box'}
899 onClick={点击复选框 func(checked, args)}
900
901 name={复选框name string, 默认无}
902 value={复选框value string, 默认无}
903 checked={是否选中 bool, 默认false}
904 disabled={是否禁用 bool, 默认false}
905
906 caption={复选框标题 string, 默认无}
907 captionClassName={复选框标题className string, 默认无, 基础'checkbox-caption'}
908 captionStyle={复选框标题style object, 默认无}
909/>
910```
911### 示例
912```javascript
913import Checkbox from 'seedsui-react/lib/Checkbox';
914
915onClick = (checked) => {
916 this.props.checkChange(!checked)
917}
918
919const {checked} = this.props;
920<Checkbox caption="全选" checked={checked} onClick={this.onClick}/>
921```
922[返回目录](#component)
923
924
925
926
927
928
929
930## Container
931[主体内容](https://unpkg.com/seedsui-react/src/lib/Container/Container.js)
932, 通常与Page、Header一起使用, 位于Header下面的位置
933### 属性
934```javascript
935<Container
936 style={容器style object, 默认无}
937 className={容器className string, 默认无, 基础'container'}
938 lazyLoad={是否启用懒人加载 bool, 默认false} // 只会在didMount时执行lazyLoadInstance.load();
939 // 异步加载时需要使用:
940 // ref="$container" 和 ref={(el) => {this.$container = el;}}, this.refs.$container === this.$container
941 // this.refs.$container.state.lazyLoadInstance.load();或this.$container.state.lazyLoadInstance.load();
942
943 {...others}
944>
945主体内容
946</Container>
947```
948### 示例
949```javascript
950import Page from 'seedsui-react/lib/Page';
951import Header from 'seedsui-react/lib/Header';
952import Container from 'seedsui-react/lib/Container';
953
954<Page>
955 <Header>
956 头部
957 </Header>
958 <Container>
959 中部
960 </Container>
961</Page>
962```
963[返回目录](#component)
964
965
966
967
968## Counter
969[计数器](https://unpkg.com/seedsui-react/src/lib/Counter/Counter.js)
970### 属性
971```javascript
972<Counter
973 style={容器style object, 默认无}
974 className={容器className string, 默认无, 基础'container'}
975 duration={动画时长 number, 默认5000}
976 from={开始数字 number, 默认0}
977 to={结束数字 number, 默认10}
978 suffix={数字不变的后缀 string, 默认无} // 如设置为/10, 则显示为0/10
979 autoplay={是否自动播放 bool, 默认true}
980 {...others}
981/>
982```
983### ref方法
984```javascript
985play() // 播放
986```
987### 示例
988```javascript
989import Counter from 'seedsui-react/lib/Counter';
990
991onClick = () => {
992 this.refs.$counter.play();
993}
994
995<Counter to={500} autoplay={false} ref="$counter"/>
996```
997[返回目录](#component)
998
999
1000
1001
1002## Dialog
1003[弹出框](https://unpkg.com/seedsui-react/src/lib/Dialog/Dialog.js)
1004### 属性
1005```javascript
1006<Dialog
1007 portal={传送dom object, 默认document.getElementById('root')}
1008 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
1009 show={*显隐 bool, 默认false}
1010
1011 animation={动画 string, 默认'fade'} // slideLeft | slideRight | slideUp | slideDown | zoom | fade
1012 duration={动画时长 number, 默认见seedsui-variable.less}
1013 isClickMaskHide={是否点击遮罩隐藏 bool, 默认true}
1014 onClickMask={点击遮罩 func(s)}
1015 onShowed={显示完成 func(s)}
1016 onHid={隐藏完成 func(s)}
1017
1018 maskClassName={遮罩className string, 默认无, 基础'mask dialog-mask'}
1019 maskStyle={遮罩style object, 默认无}
1020
1021 className={容器className string, 默认无, 基础'container'}
1022 style={容器style object, 默认无}
1023 {...others}
1024>
1025</Dialog>
1026```
1027### 示例
1028```javascript
1029import Dialog from 'seedsui-react/lib/Dialog';
1030
1031<Dialog show={this.state.showDialog} animation="zoom" duration={200} style={{width: '80%', height: '80%', backgroundColor: 'white', borderRadius: '10px'}}>
1032弹出框内容
1033</Dialog>
1034```
1035[返回目录](#component)
1036
1037
1038
1039
1040## Dot
1041[小圆点](https://unpkg.com/seedsui-react/src/lib/Dot/Dot.js)
1042### 属性
1043```javascript
1044<Dot
1045 style={图标style object, 默认无}
1046 className={图标className string, 默认无, 基础'dot'}
1047 size={宽高大小px number, 默认无}
1048 {...others}
1049/>
1050```
1051### 示例
1052```javascript
1053import Dot from 'seedsui-react/lib/Dot';
1054
1055<Dot size={8}/>
1056```
1057[返回目录](#component)
1058
1059
1060
1061
1062## Dragrefresh
1063[下拉刷新](https://unpkg.com/seedsui-react/src/lib/Dragrefresh/Dragrefresh.js)
1064### 属性
1065```javascript
1066<Dragrefresh
1067 style={容器style object, 默认无}
1068 className={容器className string, 默认无, 基础'dot'}
1069
1070 threshold={头部下拉的触发位置 number, 默认50}
1071 end={头部下拉的结束位置 number, 默认200}
1072 endRefresh={滑动到底后刷新 bool, 默认false}
1073 moveTimeout={滑动超时,解决ios手指滑动到原生tabbar上,不触发onTouchEnd number, 默认0}
1074 onTopRefresh={头部刷新 func(s)}
1075 onTopComplete={头部刷新完成 func(s)}
1076 onBottomRefresh={底部刷新 func(s)}
1077 onBottomComplete={底部刷新完成 func(s)}
1078
1079 hasMore={状态标识 number, 默认-2} // 1刷新完成 | 0没有更多数据 | -1网络错误 | 404找不到数据 | -2空闲但展现底部转圈
1080
1081 showNoData={是否允许暂无数据 bool, 默认false}
1082 noDataParams={无数据时的Notive组件属性 object, 默认无}
1083
1084 lazyLoad={是否启用懒人加载 bool, 默认false} // 每当didUpdate时会执行lazyLoadInstance.load();
1085
1086 onScroll={滚动事件 func(e)}
1087
1088 bottomLoadingCaption={底部加载中 string, 默认'正在加载...'}
1089 bottomNoDataCaption={底部加载完成 string, 默认'没有更多数据了'}
1090 bottomErrorCaption={底部加载错误 string, 默认'加载失败, 请稍后再试'}
1091 onClickBottomError={点击底部加载错误区域 func, 默认无}
1092>
1093内容
1094</Dragrefresh>
1095```
1096### 示例
1097```javascript
1098import Dragrefresh from 'seedsui-react/lib/Dragrefresh';
1099
1100this.state = {
1101 hasMore: -2, // hasMore: 0.无更多数据 1.数据加载完成 404.一条数据都没有, -1. 加载错误, -2. 重置状态,为了后面可以更新DOM
1102 list: []
1103}
1104componentDidMount () {
1105 this.loadData();
1106}
1107
1108// 下拉刷新配置
1109onTopRefresh = () => {
1110 console.log('头部刷新');
1111 this.loadData(false);
1112}
1113onBottomRefresh = () => {
1114 console.log('底部刷新');
1115 this.loadData(true);
1116}
1117loadData = () => {
1118 let list = this.state.list;
1119 let hasMore = -2; // hasMore: 0.无更多数据 1.数据加载完成 404.一条数据都没有, -1. 加载错误, -2. 重置状态,为了后面可以更新DOM
1120 this.setState({
1121 hasMore: -2 // 先重置状态, 后面再会触发react更新
1122 });
1123 setTimeout(() => {
1124 let serList = [];
1125 for (let i = 1; i <= 20; i++) {
1126 serList.push(i);
1127 }
1128 // 拼接数据
1129 list = list.concat(serList);
1130 hasMore = 1;
1131 // 如果数据大于100, 则完成加载
1132 if (list.length >= 100) {
1133 hasMore = 0;
1134 }
1135 // 更新DOM
1136 this.setState({
1137 list,
1138 hasMore
1139 });
1140 }, 1000);
1141}
1142
1143<Dragrefresh
1144 moveTimeout={1000}
1145 endRefresh
1146 ref={(el) => {this.$elDrag = el;}}
1147 hasMore={this.state.hasMore}
1148 onTopRefresh={this.onTopRefresh}
1149 onBottomRefresh={this.onBottomRefresh}
1150 bottomErrorCaption="加载失败, 点击重新加载"
1151 onClickBottomError={this.onBottomRefresh}
1152 noDataParams={{onClick: this.onTopRefresh, caption: '暂无数据, 点击重新加载'}}
1153>
1154 {this.state.list.map((item, index) => {
1155 return <div className="flex flex-middle" style={{height: '44px'}} key={index}>{item}</div>
1156 })}
1157</Dragrefresh>
1158```
1159[返回目录](#component)
1160
1161
1162
1163
1164## Dropdown
1165[下拉菜单](https://unpkg.com/seedsui-react/src/lib/Dropdown/Dropdown.js)
1166### 属性
1167```javascript
1168<Dropdown
1169 portal={弹出框传送至dom object, 默认document.getElementById('root')}
1170 top={头部距离 number, 默认0}
1171 disabled={是否禁用 bool, 默认false}
1172 onChange={选中菜单发生变化 func([{id: '', caption: ''}])}
1173 list={菜单 array, 默认无} // 格式:[{id: '', name: '分类', data: [{id: '1',name: '测试数据1',children:[]}]}]
1174/>
1175```
1176### 示例
1177```javascript
1178import Dropdown from 'seedsui-react/lib/Dropdown';
1179
1180this.state = {
1181 items: [{"id":"","name":"分类","data":[{"id":"","name":"全部","children":[]},{"id":"7938034417512813758","name":"饮料","children":[{"id":"4622400720177680517","name":"碳酸饮料"},{"id":"5800049423243362222","name":"茶饮料"},{"id":"5789432343240798823","name":"功能饮料"},{"id":"6413548566139705252","name":"饮用水"},{"id":"6936207795217715766","name":"中草药饮料"},{"id":"8746408135758103957","name":"蛋白质饮料"},{"id":"7268945622944992066","name":"果味饮料"},{"id":"9138462844675316911","name":"咖啡"}]},{"id":"7746459719734369628","name":"零食","children":[{"id":"9134066222295231258","name":"蜜饯果干"},{"id":"5394487194098598325","name":"坚果炒货"},{"id":"9070533848545878912","name":"早餐面包"},{"id":"5240328190253910837","name":"糖巧果冻"}]}]},{"id":"","name":"品牌","data":[{"id":"","name":"全部"},{"id":"其他","name":"其他"},{"id":"美汁源","name":"美汁源"},{"id":"可口","name":"可口"},{"id":"宏宝莱","name":"宏宝莱"},{"id":"康师傅","name":"康师傅"},{"id":"百事","name":"百事"},{"id":"卫岗","name":"卫岗"},{"id":"蒙牛","name":"蒙牛"},{"id":"伊利","name":"伊利"},{"id":"三只松鼠","name":"三只松鼠"}]},{"id":"","name":"筛选","data":[{"id":"","name":"全部"},{"id":"new","name":"新品"},{"id":"importance","name":"重点"}]}]
1182};
1183
1184onChangeDropdown = (tabs) => {
1185 var items = Object.clone(this.state.items);
1186 tabs.forEach((item, index) => {
1187 items[index].id = item.id;
1188 items[index].name = item.name;
1189 });
1190 this.setState({
1191 items: items
1192 })
1193}
1194
1195<Header>
1196 <Dropdown list={this.state.items} onChange={this.onChangeDropdown}/>
1197</Header>
1198```
1199[返回目录](#component)
1200
1201
1202
1203
1204## Emoji
1205[表情弹出输入框](https://unpkg.com/seedsui-react/src/lib/Emoji/Emoji.js)
1206### 属性
1207```javascript
1208<Emoji
1209 portal={弹出框传送至dom object, 默认document.getElementById('root')}
1210 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
1211 autoFocus={自动获取焦点 bool, 默认false}
1212
1213 value={值 string, 默认''}
1214 placeholder={占位文字 string, 默认''}
1215
1216 isClickMaskHide={是否点击遮罩隐藏 bool, 默认true}
1217 onClickMask={点击遮罩 func(s)}
1218
1219 maskStyle={遮罩style object, 默认无}
1220 maskClassName={遮罩className string, 默认无, 基础'mask emoji-mask'}
1221
1222 style={容器style object, 默认无}
1223 className={容器className string, 默认无, 基础'emoji'}
1224
1225 icon={图标dom node, 默认无}
1226
1227 onChange={值变化 func(value, args)}
1228 onSubmit={提交 func(value, args)}
1229/>
1230```
1231### 示例
1232```javascript
1233import Emoji from 'seedsui-react/lib/Emoji';
1234
1235this.state = {
1236 showEmoji: false,
1237 value: ''
1238}
1239
1240onChange = (value) => {
1241 this.setState({
1242 value: value
1243 })
1244}
1245
1246toggleEmoji = () => {
1247 this.setState((prevState) => {
1248 return {
1249 showEmoji: !prevState.showEmoji
1250 }
1251 })
1252}
1253
1254<Emoji
1255 autoFocus
1256 show={this.state.showEmoji}
1257 onChange={this.onChange}
1258 value={this.state.value}
1259 onClickMask={this.toggleEmoji}
1260/>
1261<input type="button" value="显隐" onClick={this.toggleEmoji}/>
1262```
1263[返回目录](#component)
1264
1265
1266
1267
1268## Footer
1269[底部内容](https://unpkg.com/seedsui-react/src/lib/Footer/Footer.js)
1270, 通常与Page、Header、Container一起使用
1271### 属性
1272```javascript
1273<Footer
1274 style={容器style object, 默认无}
1275 className={容器className string, 默认无, 基础'container'}
1276 {...others}
1277>
1278底部内容
1279</Footer>
1280```
1281### 示例
1282```javascript
1283import Page from 'seedsui-react/lib/Page';
1284import Header from 'seedsui-react/lib/Header';
1285import Footer from 'seedsui-react/lib/Footer';
1286import Container from 'seedsui-react/lib/Container';
1287
1288<Page>
1289 <Header>
1290 头部
1291 </Header>
1292 <Container>
1293 中部
1294 </Container>
1295 <Footer>
1296 底部
1297 </Footer>
1298</Page>
1299```
1300[返回目录](#component)
1301
1302
1303
1304
1305
1306
1307
1308## Group
1309[分组](https://unpkg.com/seedsui-react/src/lib/Group/Group.js)
1310### 属性
1311```javascript
1312<Group
1313 style={卡片style object, 默认无}
1314 className={卡片className string, 默认'border-tb', 基础'group'}
1315 onClick={点击 func(args)}
1316 {...others}
1317>
1318分组
1319</Group>
1320```
1321### 示例
1322```javascript
1323import Group from 'seedsui-react/lib/Group';
1324
1325<Group>
1326分组
1327</Group>
1328```
1329
1330
1331## Handsign
1332[签名](https://unpkg.com/seedsui-react/src/lib/Handsign/Handsign.js)
1333### 属性
1334```javascript
1335<Handsign
1336 strokeStyle={签名颜色 string, 默认'#000'}
1337 lineWidth={签名线粗px number, 默认3}
1338 quality={存储时的图片质量 number, 默认0.92}
1339 suffix={图片保存类型 string, 默认'image/png'}
1340 width={宽度px number, 默认300} // 不能通过style设置宽度,否则canvas会错位
1341 height={高度px number, 默认300} // 不能通过style设置高度,否则canvas会错位
1342 style={签名面板style object, 默认无}
1343 className={签名面板className string, 默认无}
1344/>
1345```
1346### 示例
1347```javascript
1348import Handsign from 'seedsui-react/lib/Handsign';
1349
1350save = () => {
1351 if (this.$handsign.instance.blank()) {
1352 console.log('空白');
1353 return;
1354 }
1355 if (!this.$handsign.instance.isDrew) {
1356 console.log('没有画过');
1357 return;
1358 }
1359 const sign_pic = this.$handsign.instance.save();
1360 console.log(sign_pic);
1361}
1362clear = () => {
1363 this.$handsign.instance.clear()
1364}
1365drawBg = () => {
1366 this.$handsign.instance.drawBackgroundColor('#ff8800')
1367}
1368
1369<Handsign ref={(el) => {this.$handsign = el;}} width={300} strokeStyle="#c72a1d" height={300}/>
1370<input type="button" value="绘制背景" onClick={this.drawBg}/>
1371<input type="button" value="保存" onClick={this.save}/>
1372<input type="button" value="清除" onClick={this.clear}/>
1373```
1374[返回目录](#component)
1375
1376
1377
1378
1379## Header
1380[头部内容](https://unpkg.com/seedsui-react/src/lib/Header/Header.js)
1381, 通常与Page、Container一起使用
1382### 属性
1383```javascript
1384<Header
1385 style={容器style object, 默认无}
1386 className={容器className string, 默认无, 基础'container'}
1387 {...others}
1388>
1389头部内容
1390</Header>
1391```
1392### 示例
1393```javascript
1394import Page from 'seedsui-react/lib/Page';
1395import Header from 'seedsui-react/lib/Header';
1396import Footer from 'seedsui-react/lib/Footer';
1397import Container from 'seedsui-react/lib/Container';
1398
1399<Page>
1400 <Header>
1401 头部
1402 </Header>
1403 <Container>
1404 中部
1405 </Container>
1406 <Footer>
1407 底部
1408 </Footer>
1409</Page>
1410```
1411[返回目录](#component)
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421## ImgMark
1422[签名](https://unpkg.com/seedsui-react/src/lib/ImgMark/ImgMark.js)
1423### 属性
1424```javascript
1425<ImgMark
1426 // 数据源
1427 src={图片地址或者base64 string, 默认无}
1428 data={标注数据 array, 默认无}
1429 // [
1430 // {
1431 // x1: 442,
1432 // x2: 492,
1433 // y1: 79,
1434 // y2: 265,
1435 // strokeStyle: 'red' // 可选
1436 // }
1437 // ]
1438 // canvas样式
1439 isDrawSrc={是否连同背景一起绘制到canvas上 bool, 默认true}
1440 watermark={预览水印 string, 默认无}
1441 strokeStyle={标注颜色 string, 默认'#00ff00'}
1442 lineWidth={标注线粗px number, 默认3}
1443 quality={存储时的图片质量 number, 默认0.92}
1444 width={宽度px number, 默认无} // 宽度会根据调度等比例缩放,它只会影响canvas外层容器,并不会影响canvas
1445 height={高度px number, 默认300} // 不能通过style设置高度,否则canvas会错位
1446 style={标注面板style object, 默认无}
1447 className={标注面板className string, 默认无}
1448
1449 preview={是否预览 bool, 默认true}
1450/>
1451```
1452### 示例
1453```javascript
1454import ImgMark from 'seedsui-react/lib/ImgMark';
1455
1456const result = {
1457 "skuList": [{
1458 "x1": 442,
1459 "x2": 492,
1460 "y1": 79,
1461 "y2": 265
1462 }, {
1463 "x1": 51,
1464 "x2": 103,
1465 "y1": 94,
1466 "y2": 263
1467 }, {
1468 "x1": 221,
1469 "x2": 269,
1470 "y1": 774,
1471 "y2": 948
1472 }, {
1473 "x1": 64,
1474 "x2": 110,
1475 "y1": 293,
1476 "y2": 473
1477 }, {
1478 "x1": 598,
1479 "x2": 643,
1480 "y1": 283,
1481 "y2": 468
1482 }, {
1483 "x1": 251,
1484 "x2": 297,
1485 "y1": 296,
1486 "y2": 472
1487 }, {
1488 "x1": 266,
1489 "x2": 312,
1490 "y1": 89,
1491 "y2": 265
1492 }, {
1493 "x1": 198,
1494 "x2": 242,
1495 "y1": 294,
1496 "y2": 474
1497 }, {
1498 "x1": 311,
1499 "x2": 355,
1500 "y1": 84,
1501 "y2": 265
1502 }, {
1503 "x1": 646,
1504 "x2": 688,
1505 "y1": 287,
1506 "y2": 466
1507 }, {
1508 "x1": 155,
1509 "x2": 196,
1510 "y1": 295,
1511 "y2": 473
1512 }, {
1513 "x1": 84,
1514 "x2": 129,
1515 "y1": 572,
1516 "y2": 720
1517 }, {
1518 "x1": 431,
1519 "x2": 475,
1520 "y1": 575,
1521 "y2": 721
1522 }, {
1523 "x1": 219,
1524 "x2": 262,
1525 "y1": 569,
1526 "y2": 720
1527 }, {
1528 "x1": 131,
1529 "x2": 174,
1530 "y1": 573,
1531 "y2": 721
1532 }, {
1533 "x1": 176,
1534 "x2": 218,
1535 "y1": 572,
1536 "y2": 720
1537 }, {
1538 "x1": 137,
1539 "x2": 180,
1540 "y1": 810,
1541 "y2": 947
1542 }, {
1543 "x1": 388,
1544 "x2": 430,
1545 "y1": 578,
1546 "y2": 719
1547 }, {
1548 "x1": 587,
1549 "x2": 627,
1550 "y1": 808,
1551 "y2": 948
1552 }, {
1553 "x1": 263,
1554 "x2": 303,
1555 "y1": 578,
1556 "y2": 717
1557 }, {
1558 "x1": 355,
1559 "x2": 401,
1560 "y1": 144,
1561 "y2": 261
1562 }, {
1563 "x1": 423,
1564 "x2": 466,
1565 "y1": 356,
1566 "y2": 473
1567 }, {
1568 "x1": 382,
1569 "x2": 422,
1570 "y1": 355,
1571 "y2": 471
1572 }, {
1573 "x1": 672,
1574 "x2": 712,
1575 "y1": 148,
1576 "y2": 254
1577 }, {
1578 "x1": 552,
1579 "x2": 596,
1580 "y1": 389,
1581 "y2": 466
1582 }, {
1583 "x1": 512,
1584 "x2": 550,
1585 "y1": 633,
1586 "y2": 721
1587 }, {
1588 "x1": 589,
1589 "x2": 627,
1590 "y1": 633,
1591 "y2": 719
1592 }, {
1593 "x1": 472,
1594 "x2": 507,
1595 "y1": 865,
1596 "y2": 956
1597 }, {
1598 "x1": 468,
1599 "x2": 510,
1600 "y1": 389,
1601 "y2": 467
1602 }, {
1603 "x1": 553,
1604 "x2": 587,
1605 "y1": 632,
1606 "y2": 720
1607 }, {
1608 "x1": 544,
1609 "x2": 585,
1610 "y1": 810,
1611 "y2": 949
1612 }, {
1613 "x1": 217,
1614 "x2": 266,
1615 "y1": 86,
1616 "y2": 271
1617 }, {
1618 "x1": 580,
1619 "x2": 625,
1620 "y1": 172,
1621 "y2": 255
1622 }, {
1623 "x1": 403,
1624 "x2": 440,
1625 "y1": 175,
1626 "y2": 259
1627 }, {
1628 "x1": 510,
1629 "x2": 551,
1630 "y1": 391,
1631 "y2": 465
1632 }, {
1633 "x1": 324,
1634 "x2": 380,
1635 "y1": 289,
1636 "y2": 471
1637 }, {
1638 "x1": 348,
1639 "x2": 388,
1640 "y1": 576,
1641 "y2": 721
1642 }, {
1643 "x1": 507,
1644 "x2": 543,
1645 "y1": 860,
1646 "y2": 950
1647 }, {
1648 "x1": 628,
1649 "x2": 666,
1650 "y1": 630,
1651 "y2": 720
1652 }, {
1653 "x1": 305,
1654 "x2": 346,
1655 "y1": 581,
1656 "y2": 720
1657 }, {
1658 "x1": 127,
1659 "x2": 195,
1660 "y1": 76,
1661 "y2": 263
1662 }, {
1663 "x1": 628,
1664 "x2": 669,
1665 "y1": 171,
1666 "y2": 255
1667 }, {
1668 "x1": 98,
1669 "x2": 135,
1670 "y1": 847,
1671 "y2": 946
1672 }, {
1673 "x1": 182,
1674 "x2": 217,
1675 "y1": 837,
1676 "y2": 943
1677 }, {
1678 "x1": 538,
1679 "x2": 578,
1680 "y1": 177,
1681 "y2": 258
1682 }, {
1683 "x1": 493,
1684 "x2": 536,
1685 "y1": 173,
1686 "y2": 259
1687 }, {
1688 "x1": 212,
1689 "x2": 255,
1690 "y1": 1112,
1691 "y2": 1205
1692 }, {
1693 "x1": 294,
1694 "x2": 351,
1695 "y1": 764,
1696 "y2": 939
1697 }]
1698};
1699
1700const result1 = {
1701 "skuList": [{
1702 "x1": 442,
1703 "x2": 492,
1704 "y1": 79,
1705 "y2": 265
1706 }, {
1707 "x1": 51,
1708 "x2": 103,
1709 "y1": 94,
1710 "y2": 263
1711 }]
1712};
1713
1714const result2 = {
1715 "skuList": [{
1716 "x1": 493,
1717 "x2": 536,
1718 "y1": 173,
1719 "y2": 259
1720 }, {
1721 "x1": 212,
1722 "x2": 255,
1723 "y1": 1112,
1724 "y2": 1205
1725 }, {
1726 "x1": 294,
1727 "x2": 351,
1728 "y1": 764,
1729 "y2": 939
1730 }]
1731};
1732
1733this.state = {
1734 data: []
1735};
1736
1737onChangeData = () => {
1738 this.setState({
1739 data: result.skuList
1740 })
1741}
1742onChangeData1 = () => {
1743 this.setState({
1744 data: result1.skuList
1745 })
1746}
1747onChangeData2 = () => {
1748 this.setState({
1749 data: result2.skuList
1750 })
1751}
1752
1753<ImgMark
1754 watermark="//res.waiqin365.com/d/common_mobile/images/placeholder/watermark.png"
1755 height={300}
1756 src="http://image-test.waiqin365.com/6692513571099135446/sku/201809/20180911195747712_05105130_CAMERA_21001006280.jpg" // 示例中,图片跨域请用cross插件解决
1757 data={this.state.data}
1758/>
1759<input type="button" value="全部" onClick={this.onChangeData}/>
1760<input type="button" value="切换1" onClick={this.onChangeData1}/>
1761<input type="button" value="切换2" onClick={this.onChangeData2}/>
1762```
1763[返回目录](#component)
1764
1765
1766
1767
1768
1769
1770
1771## ImgLazy
1772[懒人加载](https://unpkg.com/seedsui-react/src/lib/ImgLazy/ImgLazy.js)
1773, 主要为了解决图片过多, 造成网络阻塞的问题, 一般采用的是滚动加载, 并在页面加载完成后, 执行滚动加载方法load()
1774### 对象实例
1775```javascript
1776var imglazy = new ImgLazy({
1777 overflowContainer: el, // 滚动区域, 滚动加载时需要用到, 默认document.body
1778 load: 'scroll', // scroll 滚动加载 | queue 队列加载 | all 全部加载
1779 threshold: 300, // 滚动加载时, 上下扩展px加载
1780 loadAttr: 'data-load-src', // 加载地址
1781 errorAttr: 'data-error-src', // 错误地址
1782 completeAttr: 'data-complete' // 完成加载, data-complete=0代表加载错误, =1代码加载正确
1783});
1784```
1785### 对象方法
1786```javascript
1787load(); // 加载图片, load为scroll时加载可见区域, queue时队列加载完所有图片, all时加载所有图片
1788```
1789### 示例
1790```javascript
1791import ImgLazy from 'seedsui-react/lib/ImgLazy';
1792
1793// 懒人加载
1794this.setState({
1795 lazy: new ImgLazy({
1796 overflowContainer: this.$elDrag.$el
1797 })
1798});
1799
1800// 在页面加载完成的时候
1801this.state.lazy.load();
1802```
1803[返回目录](#component)
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815## IndexBar
1816[索引栏](https://unpkg.com/seedsui-react/src/lib/IndexBar/IndexBar.js)
1817, IndexBar组件默认fixed定位, 并在父组件中寻找data-indexbar-name属性的元素, 与indexs对应, 滑动或点击切换时, 修改父组件的scrollTop, 以达到滚动的效果
1818### 属性
1819```javascript
1820<IndexBar
1821 overflowContainer={滚动区域 any, 默认document.body}
1822 parent={DOM注入容器 any, 默认document.body}
1823 className={索引栏className string, 默认无, 基础'indexbar'}
1824 style={索引栏style object, 默认无}
1825 // indexs与父组件中所有data-indexbar-name元素对应即可
1826 indexs={索引集合 array, 默认['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'G', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']}
1827/>
1828```
1829### 示例
1830```javascript
1831import Container from 'seedsui-react/lib/Container';
1832import IndexBar from 'seedsui-react/lib/IndexBar';
1833<Container>
1834 <ul>
1835 <li data-indexbar-name="A">A</li>
1836 <li>阿华</li>
1837 <li>阿敏</li>
1838 <li>阿全</li>
1839 <li>阿达</li>
1840 <li data-indexbar-name="B">B</li>
1841 <li>白起</li>
1842 <li>白旭</li>
1843 <li>冰冰</li>
1844 <li data-indexbar-name="C">C</li>
1845 <li>曹操</li>
1846 <li>曹鸣</li>
1847 <li>曹捷</li>
1848 <li>陈真</li>
1849 <li>陈进</li>
1850 <li>陈明</li>
1851 <li>陈伟</li>
1852 <li>陈文</li>
1853 <li>陈晓</li>
1854 <li>陈娟</li>
1855 <li>成勇</li>
1856 <li>成婷</li>
1857 <li>成龙</li>
1858 <li data-indexbar-name="D">D</li>
1859 <li>大成子</li>
1860 <li>大舅子</li>
1861 <li>戴笠</li>
1862 <li>戴坤</li>
1863 <li>戴成虎</li>
1864 <li>邓小平</li>
1865 <li>邓稼先</li>
1866 <li>邓文迪</li>
1867 <li>邓等</li>
1868 <li>狄仁杰</li>
1869 <li>狄弟</li>
1870 <li>董文华</li>
1871 <li>董事</li>
1872 <li data-indexbar-name="F">F</li>
1873 <li>樊哙</li>
1874 <li>樊心</li>
1875 <li>冯晨晨</li>
1876 <li>冯敬尧</li>
1877 <li>冯成虎</li>
1878 <li>冯小平</li>
1879 <li>冯稼先</li>
1880 <li>冯文迪</li>
1881 <li>冯晨</li>
1882 <li>福尔杰</li>
1883 <li>福尔康</li>
1884 <li>福文华</li>
1885 <li>方文山</li>
1886 </ul>
1887 <IndexBar style={{top: '44px'}}/>
1888</Container>
1889```
1890[返回目录](#component)
1891
1892
1893
1894
1895
1896
1897## IndexArea
1898[多行文本框](https://unpkg.com/seedsui-react/src/lib/IndexArea/IndexArea.js)
1899, 默认高度见seedsui-variable.less中@input-area-height, 其它属性用法与[InputText 文本框](#inputtext) 组件一致
1900
1901
1902
1903
1904
1905
1906## InputCity
1907[城市选择框](https://unpkg.com/seedsui-react/src/lib/InputCity/InputCity.js)
1908, 其它属性用法与[InputText 文本框](#inputtext) 组件一致, 基于[PickerCity 城市选择弹框](#pickercity)组件
1909### 属性
1910```javascript
1911<InputCity
1912 data={数据源 array, 默认内置数据源}
1913 dataKeyPropertyName={data数据key的属性名称 string, 默认'key'}
1914 dataValuePropertyName={data数据value的属性名称 string, 默认'value'}
1915 dataChildPropertyName={data数据child的属性名称 string, 默认'children'}
1916 // export default [
1917 // {
1918 // "value": "北京",
1919 // "children": [
1920 // {
1921 // "value": "东城区",
1922 // "key": "110101"
1923 // }
1924 // ]
1925 // }
1926 // ]
1927 valueBindProp={值是否绑定props bool, 默认无} // 为true时只能通过props修改其value
1928 valueForKeys={选中key array, 默认无}
1929 split={分隔符 string, 默认'-'}
1930 type={城市类型 string, 默认'area'} // 'area' | 'city'
1931 onChange={值改变 func(value, option, args), 默认无}
1932 // Picker
1933 pickerMaskClassName={弹出框遮罩className string, 默认无}
1934 pickerMaskStyle={弹出框遮罩style object, 默认无}
1935 pickerClassName={弹出框className string, 默认无}
1936 pickerStyle={弹出框style object, 默认无}
1937 // 自定义Picker事件
1938 pickerShow={控制picker的显隐 bool, 默认无}
1939 onClickSubmit={点击picker确定按钮 func({target, activeOptions, activeText}), 默认无}
1940 onClickCancel={点击picker取消按钮 func({target}), 默认无}
1941 onClickMask={点击picker遮罩 func({target}), 默认无}
1942 {...others}
1943/>
1944```
1945### 示例
1946```javascript
1947import InputCity from 'seedsui-react/lib/InputCity';
1948
1949this.state = {
1950 value: ''
1951}
1952
1953onChange = (value) => {
1954 this.setState({
1955 value: value
1956 });
1957}
1958
1959<InputCity
1960 valueBindProp
1961 value={this.state.value}
1962 onChange={this.onChange}
1963 placeholder="请选择"
1964 className="border-b"
1965 pickerMaskStyle={{zIndex: '11'}}
1966 pickerMaskClassName="bg-white"
1967/>
1968```
1969[返回目录](#component)
1970
1971
1972
1973## InputColor
1974[颜色选择框](https://unpkg.com/seedsui-react/src/lib/InputColor/InputColor.js)
1975, 其它属性用法与[InputText 文本框](#inputtext) 组件一致
1976
1977## InputDate
1978[日期选择框](https://unpkg.com/seedsui-react/src/lib/InputDate/InputDate.js)
1979, 其它属性用法与[InputText 文本框](#inputtext) 组件一致, 基于[PickerDate 日期选择弹框](#pickerdate)组件
1980### 属性
1981```javascript
1982<InputDate
1983 valueForKey={选中key string, 默认无}
1984 type={日期类型 string, 默认'date'} // 'date | month | time | datetime'
1985 split={分隔符 string, 默认'-'}
1986 onChange={值改变 func(value, option, args), 默认无}
1987 onError={错误 func({msg: ''}), 默认无}
1988 // Picker
1989 pickerMaskClassName={弹出框遮罩className string, 默认无}
1990 pickerMaskStyle={弹出框遮罩style object, 默认无}
1991 pickerClassName={弹出框className string, 默认无}
1992 pickerStyle={弹出框style object, 默认无}
1993 // 自定义Picker事件
1994 pickerShow={控制picker的显隐 bool, 默认无}
1995 onClickSubmit={点击picker确定按钮 func({target, activeOptions, activeText}), 默认无}
1996 onClickCancel={点击picker取消按钮 func({target}), 默认无}
1997 onClickMask={点击picker遮罩 func({target}), 默认无}
1998 {...others}
1999/>
2000```
2001### 示例
2002```javascript
2003import InputDate from 'seedsui-react/lib/InputDate';
2004
2005this.state = {
2006 date: ''
2007}
2008
2009onChangeDate = (text) => {
2010 this.setState({
2011 date: text
2012 });
2013}
2014
2015<InputDate
2016 valueBindProp
2017 min={new Date().format('yyyy-MM-dd')}
2018 value={this.state.date}
2019 onChange={this.onChangeDate}
2020 placeholder="请选择"
2021 className="border-b"
2022 pickerMaskStyle={{zIndex: '11'}}
2023/>
2024```
2025
2026
2027## InputLocation
2028[定位框](https://unpkg.com/seedsui-react/src/lib/InputLocation/InputLocation.js)
2029, 其它属性用法与[InputText 文本框](#inputtext) 组件一致
2030### 属性
2031```javascript
2032<InputLocation
2033 locationingText={定位中显示文字 string, 默认'定位中...'}
2034 onClick={点击 func(value, args), 默认无}
2035 onChange={值改变 func(value, args), 默认无}
2036 {...others}
2037/>
2038```
2039
2040
2041## InputNumber
2042[数字输入框](https://unpkg.com/seedsui-react/src/lib/InputNumber/InputNumber.js)
2043, 其它属性用法与[InputText 文本框](#inputtext) 组件一致
2044
2045## InputPassword
2046[密码输入框](https://unpkg.com/seedsui-react/src/lib/InputPassword/InputPassword.js)
2047, 其它属性用法与[InputText 文本框](#inputtext) 组件一致
2048
2049## InputPhone
2050[手机输入框](https://unpkg.com/seedsui-react/src/lib/InputPhone/InputPhone.js)
2051, 其它属性用法与[InputText 文本框](#inputtext) 组件一致
2052
2053
2054## InputPicker
2055[选择框](https://unpkg.com/seedsui-react/src/lib/InputPicker/InputPicker.js)
2056, 其它属性用法与[InputText 文本框](#inputtext) 组件一致, 基于[Picker 滚动选择弹框](#picker)组件
2057### 属性
2058```javascript
2059<InputPicker
2060 valueForKey={选中key number | string, 默认无}
2061 list={选择列表 array, 默认无}
2062 onChange={值改变 func(value, option, args), 默认无}
2063 // Picker
2064 pickerMaskClassName={弹出框遮罩className string, 默认无}
2065 pickerMaskStyle={弹出框遮罩style object, 默认无}
2066 pickerClassName={弹出框className string, 默认无}
2067 pickerStyle={弹出框style object, 默认无}
2068 // 自定义Picker事件
2069 pickerShow={控制picker的显隐 bool, 默认无}
2070 onClickSubmit={点击picker确定按钮 func({target, activeOptions, activeText}), 默认无}
2071 onClickCancel={点击picker取消按钮 func({target}), 默认无}
2072 onClickMask={点击picker遮罩 func({target}), 默认无}
2073 {...others}
2074/>
2075```
2076### 示例
2077```javascript
2078import InputPicker from 'seedsui-react/lib/InputPicker';
2079
2080this.state = {
2081 value: '',
2082 list: [
2083 {
2084 key: '1',
2085 value: '111'
2086 },
2087 {
2088 key: '2',
2089 value: '222'
2090 },
2091 {
2092 key: '3',
2093 value: '333'
2094 }
2095 ]
2096}
2097
2098onChange = (value, option, args) => {
2099 console.log(value, option, args);
2100 this.setState({
2101 value: value
2102 });
2103}
2104
2105<InputPicker
2106 list={this.state.list}
2107 valueBindProp
2108 value={this.state.value}
2109 onChange={this.onChange}
2110 placeholder="请选择"
2111 className="border-b"
2112 pickerMaskStyle={{zIndex: '11'}}
2113 pickerMaskClassName="bg-white"
2114/>
2115```
2116[返回目录](#component)
2117
2118
2119
2120## InputPre
2121[自增高输入框](https://unpkg.com/seedsui-react/src/lib/InputPre/InputPre.js)
2122, 其它属性用法与[InputText 文本框](#inputtext) 组件一致
2123
2124
2125## InputRange
2126范围选择框
2127### 属性
2128```javascript
2129<InputRange
2130 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
2131 style={容器style object, 默认无}
2132 className={容器className string, 默认无}
2133 value={值 string | number, 默认'0'}
2134 min={最小值 string | number, 默认'0'}
2135 max={最小值 string | number, 默认'100'}
2136 step={步进值 string | number, 默认'1'}
2137 disabled={是否禁用 bool, 默认false}
2138 onChange={值改变 func(value, args), 默认无}
2139/>
2140```
2141### 示例
2142```javascript
2143import InputRange from 'seedsui-react/lib/InputRange';
2144
2145onChangeRange = (value, args) => {
2146 console.log(value, args);
2147}
2148
2149<InputRange onChange={this.onChangeRange}/>
2150```
2151[返回目录](#component)
2152
2153
2154
2155
2156## InputSafe
2157[安全强度检验框](https://unpkg.com/seedsui-react/src/lib/InputSafe/InputSafe.js)
2158, 展现三个状态: 弱、中、强
2159### 属性
2160```javascript
2161<InputSafe
2162 style={容器style object, 默认无}
2163 className={容器className string, 默认无}
2164 value={值 string | number, 默认''}
2165/>
2166```
2167### 示例
2168```javascript
2169import InputSafe from 'seedsui-react/lib/InputSafe';
2170
2171<InputSafe value="Zk001"/>
2172```
2173
2174
2175## InputSelect
2176[选择框](https://unpkg.com/seedsui-react/src/lib/InputSelect/InputSelect.js)
2177, 其它属性用法与[InputText 文本框](#inputtext) 组件一致, 基于[SelectPicker 选择弹框](#selectpicker)组件
2178### 属性
2179```javascript
2180<InputSelect
2181 valueForKey={选中key number | string, 默认无}
2182 split={分隔符 string, 默认'-'}
2183 multiple={是否允许多选 bool, 默认false}
2184 list={选择列表 array, 默认无}
2185 onChange={值改变 func(value, options, args), 默认无}
2186 // Picker
2187 pickerMaskClassName={弹出框遮罩className string, 默认无}
2188 pickerMaskStyle={弹出框遮罩style object, 默认无}
2189 pickerClassName={弹出框className string, 默认无}
2190 pickerStyle={弹出框style object, 默认无}
2191 // 自定义Picker事件
2192 pickerShow={控制picker的显隐 bool, 默认无}
2193 onClickSubmit={点击picker确定按钮 func({target, activeOptions, activeText}), 默认无}
2194 onClickCancel={点击picker取消按钮 func({target}), 默认无}
2195 onClickMask={点击picker遮罩 func({target}), 默认无}
2196 {...others}
2197/>
2198```
2199### 示例
2200```javascript
2201import InputSelect from 'seedsui-react/lib/InputSelect';
2202
2203this.state = {
2204 value: '',
2205 list: [
2206 {
2207 key: '1',
2208 value: '111'
2209 },
2210 {
2211 key: '2',
2212 value: '222'
2213 },
2214 {
2215 key: '3',
2216 value: '333'
2217 }
2218 ]
2219}
2220
2221onChange = (value, option, args) => {
2222 console.log(value, option, args);
2223 this.setState({
2224 value: value
2225 });
2226}
2227
2228<InputSelect
2229 multiple
2230 list={this.state.list}
2231 valueBindProp
2232 value={this.state.value}
2233 onChange={this.onChange}
2234 placeholder="请选择"
2235 className="border-b"
2236 pickerMaskStyle={{zIndex: '11'}}
2237 pickerMaskClassName="bg-white"
2238/>
2239```
2240[返回目录](#component)
2241
2242
2243
2244
2245
2246## InputStar
2247[评分框](https://unpkg.com/seedsui-react/src/lib/InputStar/InputStar.js)
2248### 属性
2249```javascript
2250<InputStar
2251 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
2252 min={最小值 number, 默认0}
2253 max={最大值 number, 默认5}
2254 value={值 number, 默认0}
2255 onChange={值改变 func(value), 默认无}
2256 style={容器style object, 默认无}
2257 className={容器className string, 默认无, 基础'input-star'}
2258/>
2259```
2260### 示例
2261```javascript
2262import InputStar from '../lib/InputStar';
2263
2264this.state = {
2265 value: 0
2266}
2267
2268onChange = (value) => {
2269 this.setState({
2270 value
2271 })
2272}
2273
2274<InputStar
2275 min={2}
2276 value={this.state.value}
2277 onChange={this.onChange}
2278/>
2279```
2280[返回目录](#component)
2281
2282
2283
2284
2285## InputText
2286[文本框](https://unpkg.com/seedsui-react/src/lib/InputText/InputText.js)
2287, 很多组件继承自此组件, 拥有此组件的属性, 如: InputPhone、InputPre、InputArea等
2288### 属性
2289```javascript
2290<InputText
2291 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
2292 type={类型 string, 默认'text'} // text | password
2293 valueBindProp={值是否绑定props bool, 默认无} // 为true时只能通过props修改其value
2294 pre={是否启用自动扩充功能 bool, 默认无}
2295 // 容器
2296 style={容器style object, 默认无}
2297 className={容器className string, 默认无, 基础'attribute'}
2298 onClick={点击容器 func(value, args), 默认无}
2299
2300 // 文本框
2301 name={文本框name string, 默认无}
2302 maxLength={文本框最大输入长度 string, 默认无}
2303 max={文本框最大值 string | number, 默认无} // 日期或者数字框专用
2304 min={文本框最小值 string | number, 默认无} // 日期或者数字框专用
2305 digits={文本框截取小数 string | number, 默认false} // 日期或者数字框专用
2306 readOnly={文本是否只读 bool, 默认无}
2307 disabled={文本是否禁用 bool, 默认无}
2308
2309 inputStyle={文本框style object, 默认无}
2310 inputClassName={文本框className string, 默认无}
2311 value={值 string | number, 默认''}
2312 placeholder={占位符 string, 默认''}
2313 onChange={值改变 func(value, args), 默认无}
2314 onClickInput={点击文本框 func(value, args), 默认无}
2315 onBlur={失去焦点 func(value, args), 默认无}
2316 onFocus={获取焦点 func(value, args), 默认无}
2317
2318 // 左右图标
2319 licon={左图标 node, 默认无}
2320 onClickLicon={点击左图标 func(args), 默认无}
2321
2322 ricon={右图标 node, 默认无}
2323 onClickRicon={点击右图标 func(args), 默认无}
2324
2325 // 清除按钮
2326 clear={清除 bool | func('', args), 默认无}
2327 clearClassName={清除图标className string, 默认'ricon close-icon-clear size18'} // 见Close组件
2328 clearStyle={清除图标style object, 默认无}
2329
2330 // 右侧内容
2331 rcaption={右侧内容 string, 默认无}
2332/>
2333```
2334### 示例
2335```javascript
2336import InputText from 'seedsui-react/lib/InputText';
2337
2338onChangeText = (value, args) => {
2339 console.log(value, args);
2340}
2341
2342<InputText onChange={this.onChangeText}/>
2343```
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353## Legend
2354[标题](https://unpkg.com/seedsui-react/src/lib/Legend/Legend.js)
2355### 属性
2356```javascript
2357<Legend
2358 className={容器className string, 默认无, 基础'legend'}
2359>
2360标题
2361</Legend>
2362```
2363### 示例
2364```javascript
2365import Legend from 'seedsui-react/lib/Legend';
2366
2367<Legend>标题</Legend>
2368```
2369[返回目录](#component)
2370
2371
2372
2373## Jcrop
2374[标题](https://unpkg.com/seedsui-react/src/lib/Jcrop/Jcrop.js)
2375### 属性
2376```javascript
2377<Jcrop
2378 src={图片地址 string, 默认无}
2379 rect={选区方形坐标 array, 默认无} // [10,10,100,100]
2380 scale={选区比例大小 array, 默认[.7,.5]} // [.7,.5]
2381 options={初始化选项 obj, 默认{multi: false}}
2382 onChange={选区变化事件 func({pos, src}), 默认无}
2383 className={容器className string, 默认无, 基础'legend'}
2384 {...others}
2385/>
2386```
2387### 示例
2388```javascript
2389import CanvasUtil from 'seedsui-react/lib/CanvasUtil';
2390import Jcrop from 'seedsui-react/lib/Jcrop';
2391
2392onChange = (e) => {
2393 console.log(e)
2394 this.setState({
2395 pos: e.pos,
2396 src: e.src
2397 });
2398}
2399
2400onSubmit = () => {
2401 CanvasUtil.cropImg({
2402 src: this.state.src,
2403 ...this.state.pos,
2404 onSuccess: function (base64) {
2405 console.log(base64)
2406 }
2407 });
2408}
2409
2410<Jcrop src={srcData} onChange={this.onChange} style={{width: '300px'}}/>
2411```
2412[返回目录](#component)
2413
2414
2415
2416
2417
2418
2419
2420## ListPull
2421[推送列表](https://unpkg.com/seedsui-react/src/lib/ListPull/ListPull.js)
2422### 属性
2423```javascript
2424<ListPull
2425 list={列表 array, 默认无, 示例如下:}
2426 // [{
2427 // container: node,
2428 // lButtons: [{value: '按钮文字', className: 'warn', style: object}],
2429 // rButtons: 同lButtons
2430 // }]
2431 style={容器style object, 默认无}
2432 className={容器className string, 默认无, 基础'list-pull'}
2433 onClick={点击列表 func(item, index, btn), 默认无}
2434 onShowedLeft={左侧显示 func(s), 默认无}
2435 onShowedRight={右侧显示 func(s), 默认无}
2436/>
2437```
2438### 示例
2439```javascript
2440import ListPull from 'seedsui-react/lib/ListPull';
2441
2442this.state = {
2443 listpull: [
2444 {
2445 container: <p style={{height: '50px'}}>内容</p>,
2446 lButtons: [
2447 {value: '未读', className: 'info', style: {padding: '0 12px'}}
2448 ],
2449 rButtons: [
2450 {value: '收藏', className: 'warn', style: {padding: '0 12px'}},
2451 {value: '删除', className: 'cancel', style: {padding: '0 12px'}}
2452 ],
2453 },
2454 {
2455 container: <p style={{height: '50px'}}>内容</p>,
2456 lButtons: [
2457 {value: '未读', className: 'info', style: {padding: '0 12px'}}
2458 ],
2459 rButtons: [
2460 {value: '收藏', className: 'warn', style: {padding: '0 12px'}},
2461 {value: '删除', className: 'cancel', style: {padding: '0 12px'}}
2462 ],
2463 }
2464 ]
2465}
2466
2467onShowedLeft = (s) => {
2468 var target = s.target.previousElementSibling.children[0];
2469 if (target.innerHTML === '未读') {
2470 target.classList.add('disabled');
2471 target.innerHTML = '已读';
2472 } else {
2473 target.classList.remove('disabled');
2474 target.innerHTML = '未读';
2475 }
2476 s.hide();
2477}
2478
2479onClickListPull = (item, index, btn) => {
2480 console.log(item, index, btn)
2481}
2482
2483<ListPull list={this.state.listpull} onClick={this.onClickListPull} onShowedLeft={this.onShowedLeft}/>
2484```
2485[返回目录](#component)
2486
2487
2488
2489
2490
2491
2492
2493## Loading
2494[加载中](https://unpkg.com/seedsui-react/src/lib/Loading/Loading.js)
2495### 属性
2496```javascript
2497<Loading
2498 portal={加载框传送至dom object, 默认无} // 不设置protal, 则不传送
2499 type={加载框类型 string, 默认'floating'} // 'floating | filling | custom'
2500
2501 maskStyle={遮罩style object, 默认无}
2502 maskClassName={遮罩className object, 默认无}
2503 maskBefore={遮罩第一层dom node, 默认无}
2504
2505 style={加载框style object, 默认无}
2506
2507 iconClassName={图标className string, 默认无, 基础'loading-custom-icon'}
2508 iconSrc={图标地址 string, 默认无}
2509 caption={标题 string, 默认'正在加载...'}
2510/>
2511```
2512### 示例
2513```javascript
2514import Loading from 'seedsui-react/lib/Loading';
2515
2516<Loading maskStyle={{top: '44px'}}/>
2517```
2518[返回目录](#component)
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535## LotteryWheel
2536[签名](https://unpkg.com/seedsui-react/src/lib/LotteryWheel/LotteryWheel.js)
2537### 属性
2538```javascript
2539<LotteryWheel
2540 // 数据源
2541 data={转盘数据 array, 默认无} // [{text: '', icon: '', font: '', fontTop...同数据默认值}]
2542 // 数据默认值
2543 fontFamily={文字名称 string, 默认'Arial'}
2544 fontSize={文字大小 number, 默认13}
2545 fontTop={文字头部距离 number, 默认28}
2546 fontFillStyle={文字填充样式 string, 默认'#ef694f'}
2547
2548 bgFillStyle={背景填充样式 string, 默认'#ffdf7d'}
2549 bgStrokeStyle={背景边框样式 string, 默认'#fa8b6e'}
2550 bgLineWidth={背景边框宽度 number, 默认1}
2551
2552 iconWidth={图标宽度 number, 默认42}
2553 iconHeight={图标高度 number, 默认42}
2554 iconTop={图标头部距离 number, 默认42}
2555
2556 around={转动圈数 number, 默认6}
2557 // 不能使用style制定宽高,canvas用style的width|height会导致绘图位置不正确
2558 width={转盘宽度 number, 默认300}
2559 height={转盘高度 number, 默认300}
2560 style={转盘style object, 默认无}
2561 className={转盘className string, 默认无}
2562 // 间隔
2563 spacing={转盘绘制的间距 number, 默认10}
2564 // 保存
2565 suffix={图片保存类型 string, 默认'image/png'}
2566 quality={图片保存质量 number, 默认0.92}
2567/>
2568```
2569### 示例
2570```javascript
2571import LotteryWheel from 'seedsui-react/lib/LotteryWheel';
2572import Device from '../lib/Device';
2573
2574
2575this.state = {
2576 data: [
2577 {bgFillStyle: '#ffcd76', text: '大奖', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gift.png'},
2578 {text: '100积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2579 {bgFillStyle: '#ffcd76', text: '200积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2580 {text: '300积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2581 {bgFillStyle: '#ffcd76', text: '400积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2582 {text: '500积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2583 {bgFillStyle: '#ffcd76', text: '600积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2584 {text: '700积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'}
2585 ]
2586}
2587
2588playing = false
2589play = () => {
2590 if (this.playing) {
2591 console.log('playing...');
2592 return;
2593 }
2594 this.playing = true
2595 this.$lotterywheel.instance.reset();
2596 setTimeout(() => {
2597 this.$lotterywheel.instance.play(2, () => {
2598 console.log('转动完成')
2599 });
2600 }, 10);
2601 setTimeout(() => {
2602 this.playing = false
2603 this.setState({
2604 data: [
2605 {bgFillStyle: '#ffcd76', text: '200积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2606 {text: '300积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2607 {bgFillStyle: '#ffcd76', text: '大奖', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gift.png'},
2608 {text: '100积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2609 {bgFillStyle: '#ffcd76', text: '400积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2610 {text: '500积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2611 {bgFillStyle: '#ffcd76', text: '600积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'},
2612 {text: '700积分', icon: '//res.waiqin365.com/d/dinghuo365/lotterywheel/gold.png'}
2613 ]
2614 })
2615 }, 5000);
2616}
2617
2618const containerWidth = Device.screenWidth - 40;
2619const wrapperWidth = containerWidth * 0.85;
2620
2621<div className="lotterywheel-container" style={{width: containerWidth + 'px', height: containerWidth + 'px', overflow: 'hidden'}}>
2622 <LotteryWheel
2623 ref={(el) => {this.$lotterywheel = el;}}
2624 width={wrapperWidth}
2625 height={wrapperWidth}
2626 iconWidth={containerWidth * 0.1}
2627 iconHeight={containerWidth * 0.1}
2628 data={this.state.data}
2629 />
2630 <img className="lotterywheel-border" src={'//res.waiqin365.com/d/dinghuo365/lotterywheel/border.png'} alt=""/>
2631 <img className="lotterywheel-pointer" src={'//res.waiqin365.com/d/dinghuo365/lotterywheel/pointer.png'} alt="" onClick={this.play}/>
2632</div>
2633```
2634[返回目录](#component)
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646## Mark
2647[标记](https://unpkg.com/seedsui-react/src/lib/Mark/Mark.js)
2648### 属性
2649```javascript
2650<Mark
2651 className={标记className string, 默认无, 基础'card'} // 'info | success | cancel | warn | disable | primary | hint'
2652 {...others}
2653>
2654标记文字
2655</Mark>
2656```
2657### 示例
2658```javascript
2659import Mark from 'seedsui-react/lib/Mark';
2660
2661<Mark className="success">进行中</Mark>
2662```
2663[返回目录](#component)
2664
2665
2666
2667## Marquee
2668[跑马灯](https://unpkg.com/seedsui-react/src/lib/Marquee/Marquee.js)
2669### 属性
2670```javascript
2671<Marquee
2672 style={容器style object, 默认无}
2673 className={容器className string, 默认无, 基础'marquee'}
2674 list={列表 array, 默认无} // [{key: 'xx', value: ''}]
2675
2676 contentStyle={单条style object, 默认无}
2677 contentClassName={单条className string, 默认无, 基础'marquee-li'}
2678
2679 step={一次移动数值 number, 默认50}
2680 duration={移动动画时长 number, 默认300}
2681 delay={一次移动停留时长 number, 默认2000}
2682 direction={移动方向 string, 默认'top'} // 'top | bottom | left | right'
2683 loop={是否循环 bool, 默认true}
2684 onClick={点击 func(item, index), 默认无}
2685/>
2686```
2687### 示例
2688```javascript
2689import Marquee from 'seedsui-react/lib/Marquee';
2690const list = [
2691 {
2692 key: '1',
2693 value: '标题标题'
2694 }
2695]
2696<Marquee
2697 list={list}
2698 onClick={onClick}
2699 step={48}
2700 contentStyle={{height: '38px', padding: '5px 0'}}
2701 contentClassName="flex flex-center nowrap2"
2702/>
2703```
2704[返回目录](#component)
2705
2706
2707
2708## MenuTiled
2709[平铺弹出菜单](https://unpkg.com/seedsui-react/src/lib/MenuTiled/MenuTiled.js)
2710, [MenuTiled下拉菜单](#menutiled)组件的子组件
2711### 属性
2712```javascript
2713<MenuTiled
2714 style={容器style object, 默认无}
2715 className={容器className string, 默认无, 基础'marquee'}
2716 list={列表 array, 默认无} // [{id: '1',caption: '测试数据1',children:[]}]
2717 selectedId={默认选中项的id string, 默认无}
2718 onClick={点击 func(s, item, isActived, isExtand: true展开 | false收缩, childrenCount), 默认无}
2719/>
2720```
2721### 示例
2722```javascript
2723import MenuTiled from 'seedsui-react/lib/MenuTiled';
2724// const menus = [
2725// {
2726// id: '1',
2727// name: '测试数据1',
2728// children: [
2729// {
2730// id: 'a',
2731// name: '测试数据1-a'
2732// },
2733// {
2734// id: 'b',
2735// name: '测试数据1-b',
2736// children: [
2737// {
2738// id: 'I',
2739// name: '测试数据1-b-I'
2740// },
2741// {
2742// id: 'II',
2743// name: '测试数据1-b-II'
2744// }
2745// ]
2746// }
2747// ]
2748// }
2749// ];
2750const menus = [
2751 {id: '1', name: '测试数据1', parentid: '-1'},
2752 {id: 'a', name: '测试数据1-a', parentid: '1'},
2753 {id: 'b', name: '测试数据1-b', parentid: '1'},
2754 {id: 'I', name: '测试数据1-b-I', parentid: 'b'},
2755 {id: 'II', name: '测试数据1-b-II', parentid: 'b'}
2756];
2757
2758onClickMenu = (e, item, isActived, isExtand, childrenCount) => {
2759 console.log(e, item, isActived, isExtand, childrenCount);
2760}
2761
2762<MenuTiled list={menus} selectedId={'b'} onClick={this.onClickMenu}/>
2763```
2764[返回目录](#component)
2765
2766
2767
2768## MenuTree
2769[侧边树形菜单](https://unpkg.com/seedsui-react/src/lib/MenuTree/MenuTree.js)
2770### 属性
2771```javascript
2772<MenuTree
2773 style={容器style object, 默认无}
2774 className={容器className string, 默认无, 基础'menutree'}
2775 list={列表 array, 默认无, 示例如下:}
2776 /* list: [{
2777 id: '',
2778 caption: '',
2779 active: false,
2780 children
2781 }] */
2782 selectedId={默认选中项的id string, 默认无}
2783 onClick={点击 func(s, item, isActived, isExtand: true展开 | false收缩, childrenCount), 默认无}
2784/>
2785```
2786### 示例
2787```javascript
2788import MenuTree from 'seedsui-react/lib/MenuTree';
2789
2790const mockData = [
2791 {id: '2', name: '测试数据2', parentid: '-1'},
2792 {id: '1', name: '测试数据1', parentid: '-1'},
2793 {id: 'a', name: '测试数据1-a', parentid: '1'},
2794 {id: 'b', name: '测试数据1-b', parentid: '1'},
2795 {id: 'I', name: '测试数据1-b-I', parentid: 'b'},
2796 {id: 'II', name: '测试数据1-b-II', parentid: 'b'}
2797];
2798
2799this.state = {
2800 selectedId: '2',
2801 data: mockData
2802}
2803
2804clearData = () => {
2805 this.setState({
2806 data: []
2807 });
2808}
2809addData = () => {
2810 this.setState({
2811 data: mockData
2812 });
2813}
2814
2815<MenuTree ref="$menutree" list={this.state.data} selectedId={this.state.selectedId} onClick={this.onClickMenu}/>
2816<input type="button" value="置空" onClick={this.clearData}/>
2817<input type="button" value="显示" onClick={this.addData}/>
2818```
2819[返回目录](#component)
2820
2821
2822
2823
2824
2825
2826
2827## Notice
2828[公告](https://unpkg.com/seedsui-react/src/lib/Notice/Notice.js)
2829### 属性
2830```javascript
2831<Notice
2832 style={容器style object, 默认无}
2833 className={容器className string, 默认无, 基础'notice'}
2834
2835 wrapperParams={样式为notice-wrapper的div容器属性 object, 默认无}
2836
2837 icon={图标dom node, 默认无}
2838
2839 caption={标题 string, 默认'暂无数据'}
2840 captionParams={样式为notice-wrapper的div属性 object, 默认无}
2841 sndcaption={副标题 string, 默认''}
2842 sndcaptionParams={样式为notice-wrapper的div属性 object, 默认无}
2843
2844 children={wrapper容器内子元素 node, 默认无}
2845
2846 {...others}
2847>
2848其它内容
2849</Notice>
2850```
2851### 示例
2852```javascript
2853import Notice from 'seedsui-react/lib/Notice';
2854
2855<Notice iconClassName="icon-no-network" caption="网络状态不佳" sndcaption="请尝试开关飞行模式后再试"/>
2856```
2857[返回目录](#component)
2858
2859
2860
2861
2862
2863
2864
2865## NumBox
2866[数字加减框](https://unpkg.com/seedsui-react/src/lib/NumBox/NumBox.js)
2867只有valueBindProp模式
2868### 属性
2869```javascript
2870<NumBox
2871 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
2872 changeFocus={是否点击加減时获取焦点 bool, 默认无}
2873 // 容器
2874 style={容器style object, 默认无}
2875 className={容器className string, 默认无, 基础'numbox bordered'}
2876 // 文本框
2877 inputStyle={文本框style object, 默认无}
2878 inputClassName={文本框className string, 默认无, 基础'numbox-input'}
2879 value={值 string | number, 默认无}
2880 digits={文本框截取小数 string | number, 默认无}
2881 max={最大值 string | number, 默认无}
2882 min={最小值 string | number, 默认无}
2883 placeholder={占位符 string, 默认''}
2884 name={文本框name string, 默认无}
2885 maxLength={输入长度 string, 默认'16'}
2886 disabled={是否禁用 bool, 默认无}
2887 readOnly={是否只读 bool, 默认无}
2888 required={是否必填 bool, 默认true} // 如果设置必填,则框内一定有值,默认为最小值或者0
2889 // 左右图标
2890 licon={左图标 node, 默认无}
2891 liconSrc={左图标地址 node, 默认无}
2892 liconClassName={左图标className string, 默认无, 基础'licon'}
2893 liconStyle={左图标style object, 默认无}
2894 onClickLicon={点击左图标 func(args), 默认无}
2895 liconLazyLoad={左图标懒人加载 bool, 默认无}
2896
2897 ricon={右图标 node, 默认无}
2898 riconSrc={右图标地址 node, 默认无}
2899 riconClassName={右图标className string, 默认无, 基础'ricon'}
2900 riconStyle={右图标style object, 默认无}
2901 onClickRicon={点击右图标 func(args), 默认无}
2902 riconLazyLoad={右图标懒人加载 bool, 默认无}
2903
2904 // 清除按钮
2905 clear={清除 bool | func('', args), 默认无}
2906 clearClassName={清除图标className string, 默认'ricon close-icon-clear size18'} // 见Close组件
2907 clearStyle={清除图标style object, 默认无}
2908 // events
2909 onClick={点击容器 func(e), 默认无}
2910 onClickMinus={点击减 func(value, args), 默认无}
2911 onClickPlus={点击加 func(value, args), 默认无}
2912 onClickInput={点击文本框 func(e), 默认无}
2913 onChange={值发生变化 func(value, args), 默认无}
2914 onBlur={失去焦点 func(value, args), 默认无}
2915 onFocus={获取焦点 func(value, args), 默认无}
2916 onError={值发生变化 func({msg:''}), 默认无}
2917 {...others}
2918/>
2919```
2920### 示例
2921```javascript
2922import NumBox from 'seedsui-react/lib/NumBox';
2923
2924this.state = {
2925 value: ''
2926}
2927
2928onChangeNum = (val, args) => {
2929 console.log(val, args)
2930 this.setState({
2931 value: val
2932 })
2933}
2934
2935<NumBox
2936 className="lg"
2937 digits={2}
2938 value={this.state.value}
2939 onChange={this.onChangeNum}
2940 args={['arg1', 'arg2']}
2941/>
2942```
2943[返回目录](#component)
2944
2945
2946## NumBoxPop
2947[数字加减弹出框](https://unpkg.com/seedsui-react/src/lib/NumBoxPop/NumBoxPop.js)
2948, 基于[NumBox 数字加减框](#numbox)组件, others是NumBox的属性
2949### 属性
2950```javascript
2951<NumBoxPop
2952 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
2953 // 容器
2954 show={*显隐 bool, 默认false}
2955 caption={标题 string, 默认'修改购买数量'}
2956 // 文本框
2957 value={值 string | number, 默认'1'}
2958 // events
2959 onClickCancel={点击取消 func(value, args), 默认无}
2960 onClickSubmit={点击确定 func(value, args), 默认无}
2961 // numbox属性
2962 {...others}
2963/>
2964```
2965### 示例
2966```javascript
2967import NumBoxPop from 'seedsui-react/lib/NumBoxPop';
2968
2969this.state = {
2970 show: true
2971}
2972onClickCancel = () => {
2973 this.setState({show: false});
2974}
2975onClickSubmit = (count) => {
2976 this.setState({show: false});
2977}
2978
2979<NumBoxPop
2980 min={1}
2981 show={this.state.show}
2982 value='5'
2983 onClickCancel={this.onClickCancel}
2984 onClickSubmit={this.onClickSubmit}
2985/>
2986```
2987[返回目录](#component)
2988
2989
2990
2991## NumBoxPopPointer
2992[数字加减指针](https://unpkg.com/seedsui-react/src/lib/NumBoxPopPointer/NumBoxPopPointer.js)
2993, 基于[NumBoxPop 数字加减弹出框](#numboxpop)组件
2994, 且基于[NumBox 数字加减框](#numbox)组件, others是NumBox的属性
2995### 属性
2996```javascript
2997<NumBoxPopPointer
2998 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
2999 // 容器
3000 containerClassName={容器className string, 默认无}
3001 containerStyle={容器style object, 默认无, 基础{position: 'relative'}}
3002 // pointer的numbox
3003 style={numbox框style object, 默认无}
3004 className={numbox框className string, 默认'sm'}
3005 value={值 string | number, 默认无}
3006 digits={文本框截取小数 string | number, 默认无}
3007 min={最小值 string | number, 默认0}
3008 max={最大值 string | number, 默认99999999}
3009 disabled={是否禁用 bool, 默认无}
3010 // pointer的unit
3011 unitClassName={单位className string, 默认无}
3012 unitStyle={numbox框style object, 默认{fontSize: '13px', marginLeft: '8px'}}
3013 unit={单位 string, 默认无}
3014 // events
3015 onChange={点击确定时触发 func(value, args), 默认无}
3016 // 弹出numbox属性
3017 {...others}
3018/>
3019```
3020### 示例
3021```javascript
3022import NumBoxPopPointer from 'seedsui-react/lib/NumBoxPopPointer';
3023
3024onChangeCount = (value) => {
3025 console.log(value)
3026}
3027
3028<NumBoxPopPointer
3029 min={1}
3030 value={'3'}
3031 unit={'/箱'}
3032 onChange={this.onChangeCount}
3033/>
3034```
3035[返回目录](#component)
3036
3037
3038## OnOff
3039[开关](https://unpkg.com/seedsui-react/src/lib/OnOff/OnOff.js)
3040### 属性
3041```javascript
3042<OnOff
3043 style={容器style object, 默认无}
3044 className={容器className string, 默认无, 基础'onoff'}
3045 readOnly={是否只读 bool, 默认无}
3046 checked={是否选中 bool, 默认无} // 选中时clasName将会增加'active'
3047 onCaption={开文字 string, 默认无} // 开关文字有一个为空时, className将会增加'notext'
3048 offCaption={关文字 string, 默认无}
3049 onClick={点击容器 func(bool), 默认无}
3050/>
3051```
3052### 示例
3053```javascript
3054import Checkbox from 'seedsui-react/lib/Checkbox';
3055
3056onClick = (checked) => {
3057 this.props.checkChange(!checked)
3058}
3059
3060const {checked} = this.props;
3061<List
3062 className="list-li-oneline"
3063 caption="设置为默认收货地址"
3064 rcaption={
3065 <OnOff
3066 readOnly={this.state.isFirst}
3067 className="reverse"
3068 checked={is_default === '0'}
3069 onClick={(isChecked) => {defaultChange(isChecked ? '1' : '0')}}
3070 />
3071 }
3072/>
3073```
3074[返回目录](#component)
3075
3076
3077## Page
3078[页面](https://unpkg.com/seedsui-react/src/lib/Page/Page.js)
3079, 通常与Container、Header一起使用
3080### 属性
3081```javascript
3082<Page
3083 style={容器style object, 默认无}
3084 className={容器className string, 默认无, 基础'page'}
3085 animation={动画 string, 默认无} // slideLeft | slideRight | slideUp | slideDown | zoom | fade
3086 {...others}
3087>
3088页面
3089</Page>
3090```
3091### 示例
3092```javascript
3093import Page from 'seedsui-react/lib/Page';
3094import Header from 'seedsui-react/lib/Header';
3095import Container from 'seedsui-react/lib/Container';
3096
3097<Page>
3098 <Header>
3099 头部
3100 </Header>
3101 <Container>
3102 中部
3103 </Container>
3104</Page>
3105```
3106[返回目录](#component)
3107
3108
3109## PagePull
3110[可推动页面](https://unpkg.com/seedsui-react/src/lib/PagePull/PagePull.js)
3111, 基于[Page 页面](#page)组件
3112### 属性
3113```javascript
3114<PagePull
3115 // Side 侧边栏
3116 drag={是否允许拖拽 bool, 默认true}
3117 lSide={左侧边栏 node, 默认无}
3118 lSideStyle={左侧边栏style object, 默认无}
3119 lSideClassName={左侧边栏className string, 默认无, 基础'page-side-left'}
3120 rSide={右侧边栏 node, 默认无}
3121 rSideStyle={右侧边栏style object, 默认无}
3122 rSideClassName={右侧边栏className string, 默认无, 基础'page-side-right'}
3123 transition={过渡动画 string, 默认'push'} // 'push | reveal'
3124 onShowedLeft={左侧显示 func(s), 默认无}
3125 onShowedRight={右侧显示 func(s), 默认无}
3126 {...others}
3127>
3128页面
3129</PagePull>
3130```
3131### 示例
3132```javascript
3133import Page from 'seedsui-react/lib/Page';
3134import Header from 'seedsui-react/lib/Header';
3135import Container from 'seedsui-react/lib/Container';
3136
3137<PagePull lSide={<p>左侧边栏</p>} rSide={<p>右侧边栏</p>}>
3138 <Header>
3139 头部
3140 </Header>
3141 <Container>
3142 中部
3143 </Container>
3144</PagePull>
3145```
3146[返回目录](#component)
3147
3148
3149
3150
3151## Peg
3152[小竖条](https://unpkg.com/seedsui-react/src/lib/Peg/Peg.js)
3153### 属性
3154```javascript
3155<Peg
3156 className={图标className string, 默认无, 基础'peg'}
3157 {...others}
3158/>
3159```
3160### 示例
3161```javascript
3162import Peg from 'seedsui-react/lib/Peg';
3163
3164<Peg/>
3165```
3166[返回目录](#component)
3167
3168
3169
3170
3171## Picker
3172[滚动选择弹框](https://unpkg.com/seedsui-react/src/lib/Picker/Picker.js)
3173### 属性
3174```javascript
3175<Picker
3176 portal={传送dom object, 默认document.getElementById('root')}
3177 show={*显隐 bool, 默认false}
3178
3179 value={值 number | string, 默认无}
3180 valueForKey={选中key number | string, 默认无}
3181
3182 list={列表 array, 默认无} // 格式 [{key: '', value: ''}]
3183
3184 maskStyle={遮罩style object, 默认无}
3185 maskClassName={遮罩className string, 默认无, 基础'mask popover-mask'}
3186 style={容器style object, 默认无}
3187 className={容器className string, 默认无, 基础'picker'}
3188
3189 slotClassName={一槽className string, 默认'text-center'}
3190 onClickMask={点击遮罩 func, 默认无}
3191 onClickCancel={点击取消按钮 func(s), 默认无}
3192 onClickSubmit={点击确定按钮 func(s), 默认无}
3193/>
3194```
3195### 示例
3196```javascript
3197import Picker from 'seedsui-react/lib/Picker';
3198
3199const mockPickerList = [{
3200 "key": "7004955043756964827",
3201 "value": "瓶"
3202}, {
3203 "key": "5796844733294559575",
3204 "value": "箱(=25.0000瓶)"
3205}];
3206
3207this.state = {
3208 pickerShow: false,
3209 pickerId: '',
3210 pickerList: []
3211}
3212
3213onClickSubmit = (e) => {
3214 const value = e.activeOptions[0].value;
3215 console.log(value);
3216 this.hidePicker();
3217}
3218hidePicker = () => {
3219 this.setState({
3220 pickerShow: false
3221 });
3222}
3223showPicker = () => {
3224 this.setState({
3225 pickerShow: true
3226 });
3227}
3228onClick = () => {
3229 this.setState({
3230 pickerId: '5796844733294559575',
3231 pickerList: mockPickerList,
3232 pickerShow: true
3233 });
3234}
3235
3236<input type="button" value="显示" onClick={this.onClick}/>
3237
3238<Picker
3239 list={this.state.pickerList}
3240 valueForKey={this.state.pickerId}
3241 show={this.state.pickerShow}
3242 onClickSubmit={this.onClickSubmit}
3243 onClickCancel={this.hidePicker}
3244 onClickMask={this.hidePicker}
3245/>
3246```
3247[返回目录](#component)
3248
3249
3250
3251
3252## PickerCity
3253[城市选择弹框](https://unpkg.com/seedsui-react/src/lib/PickerCity/PickerCity.js)
3254, 基于[Picker 滚动选择弹框](#picker)组件
3255### 属性
3256```javascript
3257<PickerCity
3258 data={数据源 array, 默认内置数据源}
3259 dataKeyPropertyName={data数据key的属性名称 string, 默认'key'}
3260 dataValuePropertyName={data数据value的属性名称 string, 默认'value'}
3261 dataChildPropertyName={data数据child的属性名称 string, 默认'children'}
3262 // export default [
3263 // {
3264 // "value": "北京",
3265 // "children": [
3266 // {
3267 // "value": "东城区",
3268 // "key": "110101"
3269 // }
3270 // ]
3271 // }
3272 // ]
3273 portal={传送dom object, 默认document.getElementById('root')}
3274 valueForKey={选中key string, 默认无}
3275 split={分隔符 string, 默认'-'}
3276 type={类型 string, 默认'area'} // area | city
3277
3278 maskStyle={遮罩style object, 默认无}
3279 maskClassName={遮罩className string, 默认无, 基础'mask popover-mask'}
3280 className={容器className string, 默认无, 基础'picker'}
3281 style={容器style object, 默认无}
3282 value={值 string, 默认无}
3283 show={*显隐 bool, 默认false}
3284 onClickMask={点击遮罩 func, 默认无}
3285 onClickCancel={点击取消按钮 func(s), 默认无}
3286 onClickSubmit={点击确定按钮 func(s), 默认无}
3287/>
3288```
3289### 示例
3290```javascript
3291import PickerCity from 'seedsui-react/lib/PickerCity';
3292
3293onClickSubmit = (e) => {
3294 const value = e.activeOptions[0].value;
3295 console.log(value);
3296 this.setState({
3297 show: !this.state.show
3298 });
3299}
3300onClickCancel = () => {
3301 this.setState({
3302 show: !this.state.show
3303 });
3304}
3305onClickMask = () => {
3306 this.setState({
3307 show: !this.state.show
3308 });
3309}
3310
3311<PickerCity
3312 value=""
3313 show={this.state.show}
3314 onClickSubmit={this.onClickSubmit}
3315 onClickCancel={this.onClickCancel}
3316 onClickMask={this.onClickMask}
3317/>
3318```
3319[返回目录](#component)
3320
3321
3322
3323## PickerDate
3324[日期选择弹框](https://unpkg.com/seedsui-react/src/lib/PickerDate/PickerDate.js)
3325, 基于[Picker 滚动选择弹框](#picker)组件
3326### 属性
3327```javascript
3328<PickerDate
3329 valueForKey={选中key string, 默认无}
3330 portal={传送dom object, 默认document.getElementById('root')}
3331 split={分隔符 string, 默认'-'}
3332 type={类型 string, 默认'area'} // area | city
3333
3334 maskStyle={遮罩style object, 默认无}
3335 maskClassName={遮罩className string, 默认无, 基础'mask popover-mask'}
3336 className={容器className string, 默认无, 基础'picker'}
3337 style={容器style object, 默认无}
3338 value={值 string, 默认无}
3339 show={*显隐 bool, 默认false}
3340 onClickMask={点击遮罩 func, 默认无}
3341 onClickCancel={点击取消按钮 func(s), 默认无}
3342 onClickSubmit={点击确定按钮 func(s), 默认无}
3343 onError={错误 func(s), 默认无}
3344/>
3345```
3346### 示例
3347```javascript
3348import PickerDate from 'seedsui-react/lib/PickerDate';
3349
3350onClickSubmit = (e) => {
3351 const value = e.activeOptions[0].value;
3352 console.log(value);
3353 this.setState({
3354 show: !this.state.show
3355 });
3356}
3357onClickCancel = () => {
3358 this.setState({
3359 show: !this.state.show
3360 });
3361}
3362onClickMask = () => {
3363 this.setState({
3364 show: !this.state.show
3365 });
3366}
3367
3368<PickerDate
3369 value=""
3370 show={this.state.show}
3371 onClickSubmit={this.onClickSubmit}
3372 onClickCancel={this.onClickCancel}
3373 onClickMask={this.onClickMask}
3374/>
3375```
3376[返回目录](#component)
3377
3378
3379
3380
3381
3382## Player
3383[视频播放器](https://unpkg.com/seedsui-react/src/lib/Player/Player.js)
3384
3385### 属性
3386```javascript
3387<Player
3388 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
3389 className={视频容器className string, 默认无, 基础'player-thumbnail'}
3390 style={视频容器style object, 默认无}
3391 children={视频容器内子元素 node, 默认无}
3392
3393 src={视频播放地址 string, 默认无, 基础'player-thumbnail'}
3394 onClick={点击视频 func(s), 默认无} // 设置此属性后,默认点击预览将会被此事件代替
3395 {...others} // video标签的属性,例如poster
3396/>
3397```
3398### 示例
3399```javascript
3400import Player from 'seedsui-react/lib/Player';
3401
3402onClickVideo = (args) => {
3403 Bridge.previewVideo({src: args.src});
3404}
3405
3406<Player
3407 args={{src: ''}}
3408 src={''}
3409 onClick={this.onClickVideo}
3410/>
3411```
3412[返回目录](#component)
3413
3414
3415
3416
3417
3418## Popover
3419[箭头弹框](https://unpkg.com/seedsui-react/src/lib/Popover/Popover.js)
3420### 属性
3421```javascript
3422<Popover
3423 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
3424 portal={传送dom object, 默认document.getElementById('root')}
3425 show={*显隐 bool, 默认false}
3426
3427 animation={动画 string, 默认'zoom'} // slideLeft | slideRight | slideUp | slideDown | zoom | fade
3428 isClickMaskHide={是否点击遮罩隐藏 bool, 默认true}
3429
3430 maskStyle={遮罩style object, 默认无}
3431 maskClassName={遮罩className string, 默认无, 基础'mask popover-mask'}
3432 onClickMask={点击遮罩 func(args), 默认无}
3433
3434 className={容器className string, 默认无, 基础'popover'}
3435 // 'top-left | top-center | top-right | left-top | left-middle | left-bottom', 其中top与bottom、left与right拥有相同属性
3436 style={容器style object, 默认无}
3437>
3438内容内容
3439</Popover>
3440```
3441### 示例
3442```javascript
3443import Popover from 'seedsui-react/lib/Popover';
3444
3445this.state = {
3446 popoverStyle: {top: '44px', right: '12px'},
3447 popoverClassName: 'top-left',
3448 popoverShow: false
3449}
3450
3451// 更多操作
3452showPopover = (e) => {
3453 if (!e.target) {
3454 Bridge.showToast('没有元素, 无法查看更多', {mask: false});
3455 return;
3456 }
3457 const clientRect = e.target.getBoundingClientRect();
3458 // 如果超过屏幕的的4/3, 则向上弹
3459 const screenHeight = Device.screenHeight;
3460 let popoverStyle = {top: Math.Calc.add(clientRect.y, 28) + 'px', left: clientRect.x + 'px'};
3461 let popoverClassName = 'top-left';
3462 if (clientRect.y / screenHeight > 0.75) {
3463 popoverStyle = {bottom: Math.Calc.add(Math.Calc.subtract(screenHeight, clientRect.y), 6) + 'px', left: clientRect.x + 'px'};
3464 popoverClassName = 'bottom-left';
3465 }
3466 this.setState({
3467 popoverStyle: popoverStyle,
3468 popoverClassName: popoverClassName,
3469 popoverShow: true
3470 });
3471}
3472hidePopover = () => {
3473 this.setState({
3474 popoverShow: false
3475 })
3476}
3477
3478
3479<input type="button" value="显示" onClick={this.showPopover} style={{position: 'absolute', left: '50%', top: '20px'}}/>
3480{/* 更多操作 */}
3481<Popover show={this.state.popoverShow} className={this.state.popoverClassName} style={this.state.popoverStyle} onClickMask={this.hidePopover}>
3482 操作操作<br/>
3483 操作操作<br/>
3484 操作操作<br/>
3485 操作操作<br/>
3486 操作操作
3487</Popover>
3488
3489```
3490[返回目录](#component)
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501## Preview
3502[提示弹框](https://unpkg.com/seedsui-react/src/lib/Preview/Preview.js)
3503### 建议
3504Preview预览组件, 为了解决需要预览图片上方加浮动层的问题, 一般预览建议直接使用Api直接调用:
3505* Bridge.previewImage({urls: [src], layerHTML: `<div class="preview-layer" style="background-image:url(${layer})"></div>`})代替
3506
3507详见[Bridge 桥接库](#bridge) 桥接库
3508### 属性
3509```javascript
3510<Preview
3511 portal={传送dom object, 默认document.getElementById('root')}
3512 show={*显隐 bool, 默认false}
3513 showHeader={是否显示操作头 bool, 默认false}
3514
3515 src={图片地址 string, 默认无}
3516 layerHTML={图片上方浮层 string, 默认无}
3517
3518 onClickBack={点击返回按钮 func(), 默认无}
3519/>
3520```
3521### 示例
3522```javascript
3523import Preview from 'seedsui-react/lib/Preview';
3524
3525this.state = {
3526 showPreview: false,
3527 previewSrc: 'http://image-test.waiqin365.com/6692513571099135446/sku/201809/20180911195747712_05105130_CAMERA_21001006280.jpg',
3528}
3529
3530onPreview = () => {
3531 this.setState((prevState) => {
3532 return {
3533 showPreview: !prevState.showPreview
3534 }
3535 });
3536}
3537
3538<input type="button" value="显示" onClick={this.onPreview}/>
3539<Preview
3540 show={this.state.showPreview}
3541 src={this.state.previewSrc}
3542 layerHTML={`<div class="preview-layer" style="background-image:url(//res.waiqin365.com/d/common_mobile/images/placeholder/watermark.png)"></div>`}
3543 onClickBack={this.onPreview}
3544/>
3545```
3546[返回目录](#component)
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557## Progress
3558[进度条](https://unpkg.com/seedsui-react/src/lib/Progress/Progress.js)
3559### 属性
3560```javascript
3561<Progress
3562 className={容器className string, 默认无, 基础'progress'}
3563 style={容器style object, 默认无}
3564
3565 barStyle={进度条style object, 默认无}
3566 barClassName={进度条className string, 默认无, 基础'progress-bar'}
3567
3568 captionClassName={进度条文字className string, 默认无, 基础'progress-caption'}
3569 captionStyle={进度条文字style object, 默认无}
3570
3571 percentage={百分比 number, 默认无} // 百分比与max min value, 只要一种就行了
3572 max={最大值 number, 默认100}
3573 min={最小值 number, 默认0}
3574 value={值 number | string, 默认0}
3575 showPercentage={是否显示百分比文字 bool, 默认true} // 若为false则不显示文字
3576
3577 children={子元素 node, 默认无}
3578
3579 {...others}
3580/>
3581```
3582### 示例
3583```javascript
3584import Progress from 'seedsui-react/lib/Progress';
3585
3586<Progress percentage={10}/>
3587```
3588[返回目录](#component)
3589
3590
3591## Radio
3592[单选框](https://unpkg.com/seedsui-react/src/lib/Radio/Radio.js)
3593### 属性
3594```javascript
3595<Radio
3596 args={事件参数 any, 如: [1,2, '$event'], '$event'代表点击元素的e}
3597 style={容器style object, 默认无}
3598 className={容器className string, 默认无, 基础'radio-box'}
3599 onClick={点击复选框 func(checked, args)}
3600
3601 name={复选框name string, 默认无}
3602 value={复选框value string, 默认无}
3603 checked={是否选中 bool, 默认false}
3604 disabled={是否禁用 bool, 默认false}
3605
3606 caption={复选框标题 string, 默认无}
3607 captionClassName={复选框标题className string, 默认无, 基础'radio-caption'}
3608 captionStyle={复选框标题style object, 默认无}
3609/>
3610```
3611### 示例
3612```javascript
3613import Radio from 'seedsui-react/lib/Radio';
3614
3615onClick = (checked, args) => {
3616 console.log(checked, args)
3617}
3618
3619<Radio onClick={this.onClick}/>
3620```
3621[返回目录](#component)
3622
3623
3624
3625## RouteComment
3626[评价路由](https://unpkg.com/seedsui-react/src/lib/RouteComment/RouteComment.js)
3627### 属性
3628```javascript
3629<RouteComment
3630 title={标题 string, 默认'填写意见'}
3631 placeholder={占位符 string, 默认'点击输入'}
3632
3633 buttons={操作按钮 array, 默认无, 示例如下:}
3634 /*
3635 [{
3636 valid: PropTypes.bool,
3637 caption: PropTypes.node,
3638 style: PropTypes.object,
3639 className: PropTypes.string,
3640 onClick={点击事件 func(value, item, index)}
3641 }]
3642 */
3643 children={子元素 node, 默认无}
3644/>
3645```
3646### 示例
3647```javascript
3648import {Route, withRouter} from 'react-router';
3649import RouteComment from 'seedsui-react/lib/RouteComment';
3650
3651onClickCancel = (value, item, index) => {
3652 console.log(value, item, index);
3653}
3654onClickSubmit = (value, item, index) => {
3655 console.log(value, item, index);
3656}
3657
3658<Route
3659 path={`${this.props.match.path}/approverPop`}
3660 render={() => <RouteComment
3661 buttons={[
3662 {
3663 valid: false,
3664 className: 'lg bg-white',
3665 caption: '取消',
3666 onClick: this.onClickCancel
3667 },
3668 {
3669 valid: false,
3670 className: 'lg primary',
3671 caption: '提交',
3672 onClick: this.onClickSubmit
3673 }
3674 ]}
3675 maxLength="100"
3676 title="审批"
3677 placeholder="请填写审批意见"
3678 />}
3679/>
3680```
3681[返回目录](#component)
3682
3683
3684
3685
3686## SearchBoard
3687[搜索面板](https://unpkg.com/seedsui-react/src/lib/SearchBoard/SearchBoard.js)
3688### 属性
3689```javascript
3690<SearchBoard
3691 style={容器style object, 默认无}
3692 className={容器className string, 默认'border-b', 基础'searchboard'}
3693 dbKey={搜索历史存储到db中的key string, 默认'app_search_history'}
3694 show={*显隐 bool, 默认true}
3695 showValidTags={如果没有历史记录是否隐藏面板 bool, 默认true}
3696 onClick={点击标签 func(item, index), 默认无}
3697 onClear={点击清除 func(), 默认无}
3698 expandCaption={扩展标题 string, 默认无}
3699 expandTags={扩展标签 array, 默认无} // 格式 [{value: 'xx'}]
3700 onClickExpand={点击扩展标签 func(item, index), 默认无}
3701>
3702</SearchBoard>
3703```
3704### 示例
3705```javascript
3706import SearchBoard from 'seedsui-react/lib/SearchBoard';
3707
3708this.state = {
3709 searchValue: ''
3710}
3711
3712searchGoods = (value) => {
3713 this.setState({searchValue: value});
3714 if (this.$historySearch) this.$historySearch.add({key: value, value: value});
3715 // 加载数据
3716}
3717
3718<div className="flex flex-middle" style={style}>
3719 <form className="flex flex-middle flex-1" onSubmit={this.searchGoods}>
3720 <i className="icon icon-search size20 color-sub"></i>
3721 <input type="search" ref={input => this.searchInput = input} className="searchbar-input" placeholder="商品名称/单据编号"/>
3722 <i className="icon icon-rdo-close-fill size16 color-sub" onClick={this.onClear}></i>
3723 </form>
3724 <div style={{display: 'block', fontSize: '15px', lineHeight: '30px', paddingLeft: '10px'}} onClick={this.onClickCancel}>取消</div>
3725</div>
3726
3727<SearchBoard
3728 show={goods.length === 0 && !this.state.searchValue}
3729 ref={(el) => {this.$historySearch = el;}}
3730 dbKey="app_history_search_goods"
3731 onClick={(item) => {this.searchGoods(item.value)}}
3732/>
3733```
3734[返回目录](#component)
3735
3736
3737
3738## SelectPicker
3739[选择弹框](https://unpkg.com/seedsui-react/src/lib/SelectPicker/SelectPicker.js)
3740### 属性
3741```javascript
3742<SelectPicker
3743 portal={传送dom object, 默认document.getElementById('root')}
3744 multiple={是否允许多选 bool, 默认false}
3745 value={值 number | string, 默认无}
3746 valueForKey={选中key number | string, 默认无}
3747 list={选择列表 array, 默认无} // 格式 [key: 'xx', value: 'xx']
3748
3749 maskStyle={遮罩style object, 默认无}
3750 maskClassName={遮罩className string, 默认无, 基础'mask popover-mask'}
3751 className={容器className string, 默认无, 基础'selectpicker'}
3752 style={容器style object, 默认无}
3753 slotClassName={一槽className string, 默认'text-center'}
3754 show={*显隐 bool, 默认false}
3755 onClickMask={点击遮罩 func(e), 默认无}
3756 onClickCancel={点击取消按钮 func(e), 默认无}
3757 onClickSubmit={点击确定按钮 func(selected), 默认无}
3758/>
3759```
3760### 示例
3761```javascript
3762import SelectPicker from 'seedsui-react/lib/SelectPicker';
3763
3764onClickSubmit = (e) => {
3765 const value = e.activeOptions[0].value;
3766 console.log(value);
3767 this.setState({
3768 show: !this.state.show
3769 });
3770}
3771onClickCancel = () => {
3772 this.setState({
3773 show: !this.state.show
3774 });
3775}
3776onClickMask = () => {
3777 this.setState({
3778 show: !this.state.show
3779 });
3780}
3781
3782<SelectPicker
3783 value=""
3784 show={this.state.show}
3785 onClickSubmit={this.onClickSubmit}
3786 onClickCancel={this.onClickCancel}
3787 onClickMask={this.onClickMask}
3788/>
3789```
3790[返回目录](#component)
3791
3792
3793
3794
3795## Star
3796[小竖条](https://unpkg.com/seedsui-react/src/lib/Star/Star.js)
3797### 属性
3798```javascript
3799<Star
3800 className={图标className string, 默认无, 基础'star'}
3801 onClick={点击 func(args), 默认无}
3802 {...others}
3803/>
3804```
3805### 示例
3806```javascript
3807import Star from 'seedsui-react/lib/Star';
3808
3809<Star/>
3810```
3811[返回目录](#component)
3812
3813
3814
3815
3816## Stencil
3817[加载模板](https://unpkg.com/seedsui-react/src/lib/Stencil/Stencil.js)
3818### 属性
3819```javascript
3820<Stencil
3821 className={图标className string, 默认'stencil-list', 基础'stencil'}
3822 {...others}
3823/>
3824```
3825### 示例
3826```javascript
3827import Stencil from 'seedsui-react/lib/Stencil';
3828
3829<Stencil/>
3830```
3831[返回目录](#component)
3832
3833
3834
3835
3836## Sticker
3837[标签贴](https://unpkg.com/seedsui-react/src/lib/Sticker/Sticker.js)
3838### 属性
3839```javascript
3840<Sticker
3841 type={类型 string, 默认无} // 默认className加上'sticker', type设置为line时,className加上'sticker-line'
3842 iconClassName={图标className string, 默认无, 基础'size12'}
3843 className={容器className string, 默认'top right', 基础'size12'} // 'top | bottom | right | left'
3844 style={容器style object, 默认无}
3845>
3846</Sticker>
3847```
3848### 示例
3849```javascript
3850import Sticker from 'seedsui-react/lib/Sticker';
3851
3852<Sticker>NEW</Sticker>
3853```
3854[返回目录](#component)
3855
3856
3857
3858
3859## Tabbar
3860[页签](https://unpkg.com/seedsui-react/src/lib/Tabbar/Tabbar.js)
3861### 属性
3862```javascript
3863<Tabbar
3864 style={容器style object, 默认无}
3865 className={容器className string, 默认'tabbar-line tabbar-line-width70 border-b'}
3866 // tabbar-line | tabbar-rect | tabbar-lump | tabbar-dropdown | tabbar-footer
3867 captionClassName={标题className string, 默认无, 基础'tab-caption'}
3868 captionStyle={标题style object, 默认无}
3869 sndCaptionClassName={副标题className string, 默认无, 基础'tab-sndcaption'}
3870 sndCaptionStyle={副标题style object, 默认无}
3871 list={列表 array, 默认无, 格式如下:}
3872 // [
3873 // {
3874 // icon: node,
3875 // iconActive: node,
3876 // ricon: node,
3877 // riconActive: node,
3878
3879 // name: string, // 与caption完全相同, 允许传入name或者caption
3880 // caption: string,
3881 // sndcaption: string,
3882 // active: bool,
3883
3884 // attributes: object // tab属性
3885 // style: object
3886 // }
3887 // ]
3888 tiled={宽度等分 bool, 默认宽度弹性伸缩}
3889 disabled={是否禁用 bool, 默认无}
3890 exceptOnClickActive={排除点击选中的菜单 bool, 默认true}
3891 onClick={点击页签 func(e, item, index), 默认无}
3892 activeIndex={选中项 number, 默认0}
3893/>
3894```
3895### 示例
3896```javascript
3897import Tabbar from 'seedsui-react/lib/Tabbar';
3898
3899const tabbar = [
3900 {caption: '月', dateType: '0'},
3901 {caption: '季', dateType: '1'},
3902 {caption: '年', dateType: '2'}
3903];
3904const tabActiveIndex = 0;
3905
3906onClickTab = (item, index) => {
3907 console.log(item, index)
3908}
3909
3910<Tabbar list={tabbar} activeIndex={tabActiveIndex} onClick={this.onClickTab}/>
3911```
3912[返回目录](#component)
3913
3914
3915
3916
3917## Ticket
3918[票券]](https://unpkg.com/seedsui-react/src/lib/Ticket/Ticket.js)
3919### 属性
3920```javascript
3921<Ticket
3922 style={容器style object, 默认无}
3923 className={左侧容器className string, 默认无, 基础'ticket'}
3924 legendStyle={左侧容器style object, 默认无}
3925 legendClassName={左侧容器className string, 默认无, 基础'ticket-legend'}
3926 legend={左侧容器 node, 默认无}
3927 containerStyle={左侧容器style object, 默认无}
3928 containerClassName={内容className string, 默认无, 基础'ticket-container'}
3929 onClick={点击页签 func(e), 默认无}
3930 {...others}
3931/>
3932```
3933### 示例
3934```javascript
3935import Ticket from 'seedsui-react/lib/Ticket';
3936
3937<Ticket onClick={this.onClick} className={disabled ? 'disabled' : ''} style={{margin: '12px 14px'}} legend={
3938 <div className="text-center">
3939 <p style={{fontSize: '20px'}}>{item.num}{item.input_unit_name}</p>
3940 <p style={{fontSize: '12px', marginTop: '4px'}}>满30元可用</p>
3941 </div>
3942 }
3943 containerStyle={{padding: '12px'}}>
3944 <div className="flex flex-top" style={{height: '60px'}}>
3945 <p className="list-caption nowrap2 flex-1" style={{height: '40px'}}>商品名称 规格</p>
3946 </div>
3947 <div className="flex">
3948 <p className="list-sndcaption font-size-sm flex-1">2017-07-07</p>
3949 <Price price={item.amount} unit="元" className="normal color-primary"/>
3950 </div>
3951</Ticket>
3952```
3953[返回目录](#component)
3954
3955
3956
3957
3958## Timeline
3959[时间轴](https://unpkg.com/seedsui-react/src/lib/Timeline/Timeline.js)
3960### 属性
3961```javascript
3962<Timeline
3963 list={列表 array, 默认无, 格式如下:}
3964 // [{content: node, icon: node(默认Dot), active: bool, children: node}]
3965 className={容器className string, 默认无, 基础'timeline'}
3966 style={容器style object, 默认无}
3967
3968 lineParams={div左线条属性 object, 默认无, 基础{className: 'timeline-line'}}
3969
3970 badgeParams={div左小球的容器 object, 默认无, 基础{className: 'timeline-badge'}}
3971
3972 dotParams={Dot组件小球属性 object, 默认{className: ''}}
3973
3974 {...others}
3975/>
3976```
3977### 示例
3978```javascript
3979import Timeline from 'seedsui-react/lib/Timeline';
3980
3981const timeList = [
3982 {content: <p>内容</p>, active: true}
3983]
3984<Timeline list={timeList} style={{padding: '0 0 0 18px'}}/>
3985```
3986[返回目录](#component)
3987
3988
3989
3990
3991## Timepart
3992[时间段](https://unpkg.com/seedsui-react/src/lib/Timepart/Timepart.js)
3993### 属性
3994```javascript
3995<Timepart
3996 multiple={是否允许多选 bool, 默认false}
3997 style={容器style object, 默认无}
3998 className={容器className string, 默认无, 基础'timepart'}
3999
4000 startTime={开始时间 string, 默认'07:00'}
4001 endTime={结束时间 string, 默认'22:00'}
4002 times={设置时间段 array, 默认无}
4003 // [{className: string, startTime: 'hh:ss', endTime: 'hh:ss', data: string, cover: bool}], 其中cover指允许覆盖显示
4004
4005 onChange={选中发生变化 func(times:array), 默认无}
4006 onError={发生冲突错误 func({msg:''}), 默认无}
4007/>
4008```
4009### 示例
4010```javascript
4011import Timepart from 'seedsui-react/lib/Timepart';
4012
4013<Timepart times={[{className: 'disabled', startTime: '09:00', endTime: '10:00'}]}/>
4014```
4015[返回目录](#component)
4016
4017
4018
4019
4020## Titlebar
4021[标题栏](https://unpkg.com/seedsui-react/src/lib/Titlebar/Titlebar.js)
4022### 属性
4023```javascript
4024<Titlebar
4025 className={容器className string, 默认无, 基础'titlebar'}
4026
4027 showUrlTitle={标题是否显示url中的title bool, 默认true, 将会读取url中'titlebar'参数做为标准}
4028 caption={标题 node, 默认无}
4029 // 以下三个属性, 只有caption为string类型或者显示地址栏标题时才有用
4030 captionClassName={标题className string, 默认无, 基础'titlebar-caption nowrap text-center'}
4031 captionStyle={标题style object, 默认无}
4032 onClickCaption={点击标题 func(e), 默认无}
4033
4034 lButtons={左按钮 array, 默认['$back']}
4035 // '$back' 等同于{iconClassName: 'shape-arrow-left', onClick: this.onClickBack}
4036 // 格式 [{className: string, style: object, iconClassName: string, icon: node, caption: string}]
4037
4038 rButtons={右按钮 array, 默认无}
4039 backClassName={返回按钮className string, 默认无}
4040 backStyle={返回按钮style object, 默认无}
4041 backIcon={返回按钮图标 node, 默认无}
4042 backIconClassName={返回按钮图标className string, 默认无}
4043 backIconStyle={返回按钮图标style object, 默认无}
4044 backCaption={返回按钮标题 string, 默认无}
4045 onClickBack={点击标题 func(), 默认无} // 当设置onClickBack后, 默认的onClickBack事件将被代替
4046>
4047如果此处写了内容, 将代替caption
4048</Titlebar>
4049```
4050### 示例
4051```javascript
4052import Timepart from 'seedsui-react/lib/Timepart';
4053
4054<Titlebar caption="SeedsUI" rButtons={[{ caption: 'try' , onClick: () => {console.log(1)}}]} />
4055```
4056[返回目录](#component)
4057
4058
4059
4060
4061## Toast
4062[提示弹框](https://unpkg.com/seedsui-react/src/lib/Toast/Toast.js)
4063### 建议
4064Toast组件更适用于复杂的定制弹框,一般弹框建议直接使用Api直接调用:
4065* Bridge.showToast(msg, {mask: false})代替
4066
4067详见[Bridge 桥接库](#bridge) 桥接库
4068### 属性
4069```javascript
4070<Toast
4071 portal={传送dom object, 默认document.getElementById('root')}
4072 show={*显隐 bool, 默认false}
4073
4074 duration={动画时长 number, 默认false}
4075
4076 maskClassName={遮罩className string, 默认无, 基础'mask toast-mask'}
4077 maskStyle={遮罩style object, 默认无}
4078
4079 className={弹框className string, 默认无, 基础'toast'}
4080 style={弹框style object, 默认无}
4081
4082 caption={消息 node, 默认无}
4083 captionStyle={消息style object, 默认无}
4084 captionClassName={消息className string, 默认无, 基础'toast-caption'}
4085
4086 icon={图标dom node, 默认无}
4087/>
4088```
4089### 示例
4090```javascript
4091import Toast from 'seedsui-react/lib/Toast';
4092
4093this.state = {
4094 toastShow: false,
4095 toastMsg: '',
4096}
4097
4098showMsg = (msg) => {
4099 if (this.timeout) window.clearTimeout(this.timeout);
4100 this.setState({
4101 toastShow: true,
4102 toastMsg: msg
4103 });
4104 this.timeout = setTimeout(() => {
4105 this.setState({
4106 toastShow: false
4107 });
4108 }, 2000);
4109}
4110
4111<Toast caption={this.state.toastMsg} show={this.state.toastShow} className="middle" style={{borderRadius: '4px'}}/>
4112```
4113[返回目录](#component)
4114
4115
4116
4117
4118## Tree
4119[树结构](https://unpkg.com/seedsui-react/src/lib/Tree/Tree.js)
4120### 属性
4121```javascript
4122<Tree
4123 // 容器
4124 style={树容器style object, 默认无}
4125 className={树容器className string, 默认无, 基础'tree-box'}
4126 // 树
4127 treeStyle={树style object, 默认无}
4128 treeClassName={树className string, 默认无, 基础'tree'}
4129
4130 multiple={是否需要多选 bool, 默认true} // 只有设置checkbox为true才生效
4131 checkbox={是否支持选择 bool, 默认无}
4132 bar={选中项聚合展现栏 string | node, 默认无}
4133 selected={选中项 array, 默认无} // 格式 [{id: '', name: '', parentid: ''}]
4134 list={列表项 array, 默认无} // [{id: '', name: '', parentid: ''}]
4135
4136 buttonAddHTML={添加按钮 string, 默认无}
4137 buttonAddClassName={添加按钮className string, 默认无}
4138 buttonAddSrc={添加按钮src string, 默认无}
4139 onClickAdd={点击添加按钮 func({id:'', name: '', parentid: ''}, s), 默认无}
4140
4141 buttonDelHTML={添加按钮 string, 默认无}
4142 buttonDelClassName={添加按钮className string, 默认无}
4143 buttonDelSrc={添加按钮src string, 默认无}
4144 onClickDel={点击添加按钮 func({id:'', name: '', parentid: ''}, s), 默认无}
4145
4146 onClickLastChild={点击底层节点 func(s), 默认无}
4147
4148 onClick={点击节点 func(e, item, isActived, isExtand, childrenCount), 默认无}
4149 onData={数据加载时,可修改dom func(option), 默认无}
4150/>
4151```
4152### 示例
4153```javascript
4154import Tree from 'seedsui-react/lib/Tree';
4155
4156const groupList = [
4157 {
4158 "id": "97666a35-778e-4d28-a973-df7144fe5887",
4159 "name": "开发二部一室",
4160 "parentid": "3fbb06c3-6ac5-4a19-9252-898818da5c30",
4161 },
4162 {
4163 "id": "93fe4fa2-e75e-4e98-833d-7cdecdf2e3f9",
4164 "name": "开发一部",
4165 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4166 },
4167 {
4168 "id": "afb6ae14-5d23-4117-b819-cc7e705e8ddb",
4169 "name": "开发一部一室",
4170 "parentid": "93fe4fa2-e75e-4e98-833d-7cdecdf2e3f9",
4171 },
4172 {
4173 "id": "3fbb06c3-6ac5-4a19-9252-898818da5c30",
4174 "name": "开发二部",
4175 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4176 },
4177 {
4178 "id": "bd8b7116-e5ae-4813-b2a7-a38f56ce10d1",
4179 "name": "开发二部二室",
4180 "parentid": "3fbb06c3-6ac5-4a19-9252-898818da5c30",
4181 },
4182 {
4183 "id": "7eb397f6-daed-41f9-8985-ac2c2129ef9b",
4184 "name": "开发一部二室",
4185 "parentid": "93fe4fa2-e75e-4e98-833d-7cdecdf2e3f9",
4186 },
4187 {
4188 "id": "87154769-0d80-4459-a0cb-df68b26e4011",
4189 "name": "开发二部三室",
4190 "parentid": "3fbb06c3-6ac5-4a19-9252-898818da5c30",
4191 },
4192 {
4193 "id": "380e2247-1179-40e2-91e1-8851dd5f24ef",
4194 "name": "开发三部",
4195 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4196 },
4197 {
4198 "id": "41eddac1-e560-47c9-8ea0-c39838e93bb5",
4199 "name": "开发一部三室",
4200 "parentid": "93fe4fa2-e75e-4e98-833d-7cdecdf2e3f9",
4201 },
4202 {
4203 "id": "56a81fea-03f4-41e1-a521-ea14513a65c6",
4204 "name": "业务产品部",
4205 "parentid": "-1",
4206 },
4207 {
4208 "id": "dbc1599b-41a1-49bb-8230-a230e0927016",
4209 "name": "UED部",
4210 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4211 },
4212 {
4213 "id": "abd197f0-1ce5-4e42-a6b0-063cf22633d2",
4214 "name": "测试部",
4215 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4216 },
4217 {
4218 "id": "0a9ba2be-94d8-4163-85d2-940ccbf5ede1",
4219 "name": "广州开发部",
4220 "parentid": "0b189355-76f5-430d-bcdc-ccce65880021",
4221 },
4222 {
4223 "id": "0a9ba2be-94d8-4163-468i-940ccbf5ede1",
4224 "name": "广州开发部一室",
4225 "parentid": "0a9ba2be-94d8-4163-85d2-940ccbf5ede1",
4226 },
4227 {
4228 "id": "0d736fce-5f4a-4603-acc2-1ed4d3f4a578",
4229 "name": "运营支撑部",
4230 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4231 },
4232 {
4233 "id": "c6e56510-c293-48bc-ac8e-bfa3a1926417",
4234 "name": "办公室",
4235 "parentid": "-1",
4236 },
4237 {
4238 "id": "483d-94d8-4163-85d2-940ccbf5ede1",
4239 "name": "办公室1",
4240 "parentid": "c6e56510-c293-48bc-ac8e-bfa3a1926417",
4241 },
4242 {
4243 "id": "693a-5f4a-4603-acc2-1ed4d3f4a578",
4244 "name": "办公室1-1",
4245 "parentid": "483d-94d8-4163-85d2-940ccbf5ede1",
4246 },
4247 {
4248 "id": "f83fe35c-a93e-4332-a3a4-8c16b7b9e4db",
4249 "name": "财务部",
4250 "parentid": "-1",
4251 },
4252 {
4253 "id": "e58f452e-a3d4-4eff-9f00-fbcf57342267",
4254 "name": "残酷吗?VC的筛选法则:看100个案子投1个",
4255 "parentid": "7576b7b4-1e15-4b09-8d4c-47ca7edb36fe",
4256 },
4257 {
4258 "id": "ed991ebb-872b-4943-838d-41e51d145cf4",
4259 "name": "测试二室",
4260 "parentid": "abd197f0-1ce5-4e42-a6b0-063cf22633d2",
4261 },
4262 {
4263 "id": "c74b5302-1293-4087-a684-04104e7da402",
4264 "name": "测试三室",
4265 "parentid": "abd197f0-1ce5-4e42-a6b0-063cf22633d2",
4266 },
4267 {
4268 "id": "8144c2fa-a39b-4959-8251-3327a683df4c",
4269 "name": "测试一室",
4270 "parentid": "abd197f0-1ce5-4e42-a6b0-063cf22633d2",
4271 },
4272 {
4273 "id": "2b33aea3-3745-4ed3-9457-5494aee5e344",
4274 "name": "工程及运维部",
4275 "parentid": "0b189355-76f5-430d-bcdc-ccce65880021",
4276 },
4277 {
4278 "id": "728fd935-fb28-4154-8e3f-74ca29a2460f",
4279 "name": "集成开发二部",
4280 "parentid": "0b189355-76f5-430d-bcdc-ccce65880021",
4281 },
4282 {
4283 "id": "a6781fb8-9968-4134-8fd0-564821ea7058",
4284 "name": "集成开发一部",
4285 "parentid": "0b189355-76f5-430d-bcdc-ccce65880021",
4286 },
4287 {
4288 "id": "13ed5bf3-1b91-4fca-9303-ee8071b32154",
4289 "name": "内勤组",
4290 "parentid": "b93d94c6-7e30-4caf-89eb-188bef40b3ba",
4291 },
4292 {
4293 "id": "47f9b708-ab98-4fb3-a643-217db2074c73",
4294 "name": "人力资源部",
4295 "parentid": "-1",
4296 },
4297 {
4298 "id": "a87d375e-61ba-470a-914c-30eb94e21adf",
4299 "name": "市场北京办",
4300 "parentid": "b93d94c6-7e30-4caf-89eb-188bef40b3ba",
4301 },
4302 {
4303 "id": "d0d02e37-114c-4446-b870-06e99f9e1394",
4304 "name": "市场广州办",
4305 "parentid": "b93d94c6-7e30-4caf-89eb-188bef40b3ba",
4306 },
4307 {
4308 "id": "90fea6c9-0f66-45b0-a3c1-bb209beac12e",
4309 "name": "市场南京办",
4310 "parentid": "b93d94c6-7e30-4caf-89eb-188bef40b3ba",
4311 },
4312 {
4313 "id": "0a39cee5-a280-45c7-a41e-1998855e3ef1",
4314 "name": "市场上海办",
4315 "parentid": "b93d94c6-7e30-4caf-89eb-188bef40b3ba",
4316 },
4317 {
4318 "id": "221b9674-ac71-45ba-81f1-4b4be1df4314",
4319 "name": "市场武汉办",
4320 "parentid": "b93d94c6-7e30-4caf-89eb-188bef40b3ba",
4321 },
4322 {
4323 "id": "ce1ebf90-9540-41d4-9b79-c30441913ad2",
4324 "name": "市场支持",
4325 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4326 },
4327 {
4328 "id": "7576b7b4-1e15-4b09-8d4c-47ca7edb36fe",
4329 "name": "微软宣布新一轮裁员或影响1000人",
4330 "parentid": "97666a35-778e-4d28-a973-df7144fe5887",
4331 },
4332 {
4333 "id": "3e12ef76-9235-48c5-bff8-27fbd56111cb",
4334 "name": "项目管理部",
4335 "parentid": "-1",
4336 },
4337 {
4338 "id": "b93d94c6-7e30-4caf-89eb-188bef40b3ba",
4339 "name": "销售二部",
4340 "parentid": "56a81fea-03f4-41e1-a521-ea14513a65c6",
4341 },
4342 {
4343 "id": "99bc0450-4e64-42e6-99cb-2c5686a4c0b3",
4344 "name": "系统集成部",
4345 "parentid": "56a81fea-03f4-41e1-a521-ea14513a65c6",
4346 },
4347 {
4348 "id": "96a2835b-a1b2-4556-bf68-cb0038042b57",
4349 "name": "移动平台产品线",
4350 "parentid": "56a81fea-03f4-41e1-a521-ea14513a65c6",
4351 },
4352 {
4353 "id": "0b189355-76f5-430d-bcdc-ccce65880021",
4354 "name": "应用交付产品线",
4355 "parentid": "56a81fea-03f4-41e1-a521-ea14513a65c6",
4356 },
4357 {
4358 "id": "d3a6be54-30f0-4e82-8083-a7ed8456d03d",
4359 "name": "运营体系",
4360 "parentid": "-1",
4361 },
4362 {
4363 "id": "6bb5a527-5800-4583-a749-bbb53e639d52",
4364 "name": "支撑二室",
4365 "parentid": "0d736fce-5f4a-4603-acc2-1ed4d3f4a578",
4366 },
4367 {
4368 "id": "abdab8ba-7a99-462e-b022-56c69b3ae4fd",
4369 "name": "支撑一室",
4370 "parentid": "0d736fce-5f4a-4603-acc2-1ed4d3f4a578",
4371 },
4372 {
4373 "id": "8ff29a2a-0960-4bd7-81be-0e4a649ba701",
4374 "name": "未分组部门",
4375 "parentid": "-1",
4376 }
4377];
4378var userList1 = [
4379 {
4380 isPeople: true,
4381 "id": "xiali",
4382 "name": "夏立",
4383 "parentid": "56a81fea-03f4-41e1-a521-ea14513a65c6",
4384 },
4385 {
4386 isPeople: true,
4387 "id": "liuyu",
4388 "name": "刘宇",
4389 "parentid": "56a81fea-03f4-41e1-a521-ea14513a65c6"
4390 }
4391];
4392var userList2 = [
4393 {
4394 isPeople: true,
4395 "id": "liguanghui",
4396 "name": "李广辉",
4397 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57"
4398 },
4399 {
4400 isPeople: true,
4401 "id": "xuguolong",
4402 "name": "徐国龙",
4403 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57"
4404 },
4405 {
4406 isPeople: true,
4407 "id": "zhujingjing",
4408 "name": "朱晶晶",
4409 "parentid": "96a2835b-a1b2-4556-bf68-cb0038042b57"
4410 }
4411];
4412
4413// 展开全部
4414onExtend = () => {
4415 this.$tree.instance.extendAll();
4416}
4417// 展开全部
4418onCollapse = () => {
4419 this.$tree.instance.collapseAll();
4420}
4421// 异步加载的方法, 点击Title, 去请求数据
4422onAsync = (e, item, isActived, isExtend, childrenCount) => {
4423 if (!isExtend || e.targetLine.hasData) return;
4424 var ul = e.targetLine.nextElementSibling;
4425 if (item.id === "56a81fea-03f4-41e1-a521-ea14513a65c6") { // 加载业务产品部
4426 console.log('加载业务产品部');
4427 this.$tree.instance.addData(userList1, item.id, ul);
4428 e.targetLine.hasData = true;
4429 }
4430 if (item.id === "96a2835b-a1b2-4556-bf68-cb0038042b57") { // 加载移动平台产品线
4431 console.log('加载移动平台产品线');
4432 this.$tree.instance.addData(userList2, item.id, ul);
4433 e.targetLine.hasData = true;
4434 }
4435}
4436// 添加数据时, 可手动修改它的样式
4437onData = (option) => {
4438 if (option.isPeople) {
4439 var photo = "";
4440 if (option.avatarUrl) {
4441 photo = '<span class="tree-avatar" style="background-image:url(' + option.avatarUrl + ')"></span>';
4442 } else {
4443 // photo = '<span class="tree-avatar" style="background-color:' + option.name.substr(0, 1).toPinyin().substr(0, 1).toColor() + '">' + option.name.substr(option.name.length - 2, 2) + '</span>';
4444 photo = '<span class="tree-avatar">' + option.name.substr(option.name.length - 2, 2) + '</span>';
4445 }
4446 option.html = '<div class="tree-icon">' + photo + '</div>' +
4447 '<div class="tree-title">' + option.name + '</div>';
4448 }
4449}
4450// 查看选中信息
4451onSubmit = () => {
4452 let selected = this.$tree.instance.selected;
4453 console.log(selected);
4454}
4455
4456<div id="idTreeBar" className="tree-bar"></div>
4457<Tree
4458 ref={(el) => {this.$tree = el}}
4459 list={groupList}
4460 multiple={false}
4461 checkbox
4462 onClick={this.onAsync}
4463 onData={this.onData}
4464 selected={[{id: '56a81fea-03f4-41e1-a521-ea14513a65c6', name: '业务产品部', parentid: '-1'}]}
4465 bar="#idTreeBar"
4466/>
4467<input type="button" className="button lg" value="查看选中" onClick={this.onSubmit}/>
4468<input type="button" className="button lg" value="展开全部" onClick={this.onExtend}/>
4469<input type="button" className="button lg" value="收缩全部" onClick={this.onCollapse}/>
4470```
4471[返回目录](#component)
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487## MapUtil
4488[地图工具](https://unpkg.com/seedsui-react/src/lib/MapUtil/BaiduMap.js)
4489### 方法
4490
4491### 示例
4492```javascript
4493import MapUtil from './../lib/MapUtil';
4494import GeoUtil from './../lib/GeoUtil.js';
4495var greinerHormann = require('polygon-clipping');
4496
4497
4498const MapContainer = styled.div`
4499 position: absolute;
4500 top: 0;
4501 left: 0;
4502 right: 0;
4503 bottom: 0;
4504`
4505
4506const ButtonDraw = styled.div`
4507 position: absolute;
4508 width: 92px;
4509 height: 32px;
4510 line-height: 32px;
4511 top: 20px;
4512 right: 20px;
4513 z-index: 1;
4514 border-radius: 2px;
4515 text-align: center;
4516 box-shadow: rgba(0, 0, 0, 0.1) 0px 2px 4px 0px;
4517 cursor: pointer;
4518 background: #fff;
4519`
4520
4521const redMapStyle = {
4522 strokeColor: '#f53e2d',
4523 strokeWeight: 1,
4524 strokeOpacity: 0.8,
4525 strokeStyle: 'solid',
4526 fillColor: '#f53e2d',
4527 fillOpacity: 0.6
4528}
4529
4530var redMap = {}
4531var blueMap = {}
4532
4533
4534
4535componentDidMount () {
4536 Bridge.debug = true
4537 this.mapUtil = new MapUtil('map');
4538 this.initMap();
4539}
4540
4541// 添加鼠标绘制工具监听事件,用于获取绘制结果
4542initMap = () => {
4543 if (this.mapUtil && this.mapUtil.drawingManager) {
4544 this.mapUtil.showScale();
4545 this.mapUtil.showNavigation();
4546 this.mapUtil.drawingManager.addEventListener('overlaycomplete', this.drawBlue);
4547 this.drawRed();
4548 }
4549}
4550// 绘制总区域
4551drawRed = () => {
4552 this.mapUtil.drawBoundary({
4553 area: '江苏省南京市',
4554 styleOptions: redMapStyle,
4555 onSuccess: (res) => {
4556 redMap['red-nanjing'] = res.polygons;
4557 this.mapUtil.map.setViewport(res.polygonsPath);
4558 },
4559 onError: (msg) => {
4560 alert(msg)
4561 }
4562 });
4563 this.mapUtil.drawBoundary({
4564 area: '江苏省镇江市',
4565 styleOptions: redMapStyle,
4566 onSuccess: (res) => {
4567 redMap['red-zhengjiang'] = res.polygons;
4568 this.mapUtil.map.setViewport(res.polygonsPath);
4569 },
4570 onError: (msg) => {
4571 alert(msg)
4572 }
4573 });
4574}
4575// 手动绘制可选区域
4576drawBlue = (e) => {
4577 const polygon = e.overlay;
4578 var id = 'blue-' + new Date().getTime();
4579 const shape = this.mapUtil.drawPolygon({
4580 polygon: polygon,
4581 onSuccess: () => {
4582 // 判断多边形是否合法
4583 if (GeoUtil.isRegularPolygon(
4584 polygon.so.map(point => {
4585 return [point.lat, point.lng]
4586 })
4587 )
4588 ) {
4589 this.mapUtil.map.removeOverlay(polygon);
4590 alert('不是一个标准的多边形');
4591 return;
4592 }
4593 this.mapUtil.map.removeOverlay(polygon);
4594 // 添加到map中
4595 console.log('添加到blueMap中');
4596 console.log(polygon);
4597 blueMap[id] = polygon;
4598 // 绘制的坐标点
4599 var source = polygon.so.map((point) => {return [point.lng, point.lat]});
4600 console.log('绘制的坐标点');
4601 console.log(source);
4602 let pointss = this.redMerge([source]);
4603 console.log('取与红色区域的交集');
4604 console.log(pointss);
4605 // 绘制交集
4606 for (let points of pointss) {
4607 var polygons = this.mapUtil.pointsToPolygons(points);
4608 polygons = polygons.map((polygon) => {
4609 return {
4610 polygon: polygon,
4611 }
4612 });
4613 console.log('多边形');
4614 console.log(polygons);
4615 this.mapUtil.drawPolygons(polygons);
4616 }
4617
4618 // if (points && points.length && points[0] && points[0][0]) {
4619 // console.log(arr[0][0])
4620 // var polygon = this.mapUtil.pointsToPolygon(arr[0][0]);
4621 // console.log(polygon)
4622 // polygons.push(polygon);
4623 // return polygons;
4624 // }
4625 },
4626 onError: (msg) => {
4627 alert(msg)
4628 }
4629 });
4630 blueMap[id] = shape
4631 this.addContextMenu(id, shape)
4632}
4633// 启用手动绘制
4634enableManualDraw = () => {
4635 this.mapUtil.enableManualDraw()
4636}
4637// 添加右键, id用于获取和删除覆盖物值班表和
4638addContextMenu(id, overlay){
4639 this.mapUtil.addContextMenu(overlay, {
4640 menus: [
4641 {
4642 text: '删除',
4643 handler: () => {
4644 if (confirm('您确定要删除吗')) {
4645 this.mapUtil.map.removeOverlay(overlay)
4646 if (blueMap.has(id)) blueMap.delete(id)
4647 }
4648 }
4649 }
4650 ]
4651 })
4652}
4653// 红色区域取交集
4654redMerge = (source) => {
4655 // 与灰色区域取差集
4656 var polygons = [];
4657 for (var redOverlays of Object.values(redMap)) {
4658 for (var redOverlay of redOverlays) {
4659 // 必须分开裁切, 一次性裁切会报错
4660 var clip = redOverlay.so.map((point) => {return [point.lng, point.lat]});
4661 var result = greinerHormann.intersection(source, [clip]);
4662 if (result && result.length) polygons.push(result[0]);
4663 }
4664 }
4665 return polygons;
4666}
4667
4668
4669<MapContainer id="map"></MapContainer>
4670<ButtonDraw onClick={this.enableManualDraw}>划分区域</ButtonDraw>
4671```
4672[返回目录](#utils)
4673
4674
4675
4676
4677
4678
4679## GeoUtil
4680[地理工具](https://unpkg.com/seedsui-react/src/lib/GeoUtil.js)
4681
4682### 多边形转线
4683
4684
4685| 方法 | 返回值 | 说明 |
4686| --- | --- | --- |
4687| polygonToLines | <code>Line&lt;Array&gt;</code> | 多边形
4688
4689<br/>
4690
4691| 参数 | 参数类型 | 说明 |
4692| --- | --- | --- |
4693| polygon | <code>Number</code> | 多边形 |
4694| isRegular | <code>Boolean</code> | 是否要求是一个标准的多边形, 如果传true, 则返回集合会加上首尾互连
4695
4696
4697### 示例
4698```javascript
4699var lines = GeoUtils.polygonToLines([[1,0], [2, 0], [3, 0]], true)
4700console.log(lines)
4701```
4702[返回目录](#utils)