Browse Source
fixed: https://github.com/ant-design/test/issues/76#issuecomment-335699689pull/18/head
committed by
GitHub
25 changed files with 376 additions and 197 deletions
@ -0,0 +1,16 @@ |
|||||
|
--- |
||||
|
order: 0 |
||||
|
title: Simple |
||||
|
--- |
||||
|
|
||||
|
简单的页头。 |
||||
|
|
||||
|
````jsx |
||||
|
import CountDown from 'ant-design-pro/lib/CountDown'; |
||||
|
|
||||
|
const targetTime = new Date().getTime() + 3900000; |
||||
|
|
||||
|
ReactDOM.render( |
||||
|
<CountDown target={targetTime} /> |
||||
|
, mountNode); |
||||
|
```` |
||||
@ -0,0 +1,16 @@ |
|||||
|
--- |
||||
|
category: Components |
||||
|
type: General |
||||
|
title: CountDown |
||||
|
subtitle: 倒计时 |
||||
|
cols: 1 |
||||
|
--- |
||||
|
|
||||
|
倒计时组件。 |
||||
|
|
||||
|
## API |
||||
|
|
||||
|
| 参数 | 说明 | 类型 | 默认值 | |
||||
|
|----------|------------------------------------------|-------------|-------| |
||||
|
| format | 时间格式化显示显示 | Function(time) | | |
||||
|
| target | 目标时间 | Date | - | |
||||
@ -1,32 +0,0 @@ |
|||||
import React, { Component } from 'react'; |
|
||||
import { Tooltip } from 'antd'; |
|
||||
|
|
||||
import styles from './index.less'; |
|
||||
|
|
||||
/* eslint no-return-assign: 0 */ |
|
||||
class MapChart extends Component { |
|
||||
getRect() { |
|
||||
// 0.4657 = 708 / 1520 (img origin size)
|
|
||||
const width = this.root.offsetWidth; |
|
||||
const height = width * 0.4657; |
|
||||
return { |
|
||||
width, |
|
||||
height, |
|
||||
}; |
|
||||
} |
|
||||
|
|
||||
render() { |
|
||||
return ( |
|
||||
<div className={styles.mapChart} ref={n => (this.root = n)}> |
|
||||
<Tooltip title="等待实现"> |
|
||||
<div className={styles.canvas} ref={n => (this.root = n)}> |
|
||||
<img src="https://gw.alipayobjects.com/zos/rmsportal/fBcAYoxWIjlUXwDjqvzg.png" alt="map" /> |
|
||||
<div ref={n => (this.node = n)} /> |
|
||||
</div> |
|
||||
</Tooltip> |
|
||||
</div> |
|
||||
); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
export default MapChart; |
|
||||
@ -1,10 +0,0 @@ |
|||||
.mapChart { |
|
||||
background-color: #fff; |
|
||||
position: relative; |
|
||||
.canvas { |
|
||||
width: 100%; |
|
||||
& > img { |
|
||||
width: 100%; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,45 +0,0 @@ |
|||||
import React from 'react'; |
|
||||
import { Button, Input } from 'antd'; |
|
||||
|
|
||||
import styles from './index.less'; |
|
||||
|
|
||||
export default class SearchInput extends React.Component { |
|
||||
state = { |
|
||||
value: this.props.defaultValue, |
|
||||
} |
|
||||
|
|
||||
handleOnChange = (e) => { |
|
||||
this.setState({ |
|
||||
value: e.target.value, |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
handleOnSearch = () => { |
|
||||
if (this.props.onSearch) { |
|
||||
this.props.onSearch(this.state.value); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
handleOnKey = (e) => { |
|
||||
if (e.keyCode === 13) { |
|
||||
this.handleOnSearch(); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
render() { |
|
||||
const { text = '搜索', reset } = this.props; |
|
||||
return ( |
|
||||
<div className={styles.search}> |
|
||||
<Input |
|
||||
onKeyDown={this.handleOnKey} |
|
||||
placeholder="请输入" |
|
||||
size="large" |
|
||||
{...reset} |
|
||||
value={this.state.value} |
|
||||
onChange={this.handleOnChange} |
|
||||
addonAfter={<Button onClick={this.handleOnSearch} type="primary">{text}</Button>} |
|
||||
/> |
|
||||
</div> |
|
||||
); |
|
||||
} |
|
||||
} |
|
||||
@ -1,24 +0,0 @@ |
|||||
@import "~antd/lib/style/themes/default.less"; |
|
||||
|
|
||||
.search { |
|
||||
display: inline-block; |
|
||||
:global { |
|
||||
.ant-input-group-addon { |
|
||||
border: none; |
|
||||
padding: 0; |
|
||||
} |
|
||||
.ant-input-group .ant-input { |
|
||||
width: 522px; |
|
||||
} |
|
||||
} |
|
||||
input { |
|
||||
border-right: none; |
|
||||
height: 40px; |
|
||||
line-height: 40px; |
|
||||
} |
|
||||
button { |
|
||||
border-radius: 0 @border-radius-base @border-radius-base 0; |
|
||||
width: 86px; |
|
||||
height: 40px; |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,30 @@ |
|||||
|
--- |
||||
|
order: 0 |
||||
|
title: Simple |
||||
|
--- |
||||
|
|
||||
|
简单的页头。 |
||||
|
|
||||
|
````jsx |
||||
|
import TagSelect from 'ant-design-pro/lib/CountDown'; |
||||
|
|
||||
|
const TagOption = TagSelect.Option; |
||||
|
const TagExpand = TagSelect.Expand; |
||||
|
|
||||
|
function handleFormSubmit(checkedValue) { |
||||
|
console.log(checkedValue); |
||||
|
} |
||||
|
|
||||
|
ReactDOM.render( |
||||
|
<TagSelect onChange={handleFormSubmit}> |
||||
|
<TagOption value="cat1">类目一</TagOption> |
||||
|
<TagOption value="cat2">类目二</TagOption> |
||||
|
<TagOption value="cat3">类目三</TagOption> |
||||
|
<TagOption value="cat4">类目四</TagOption> |
||||
|
<TagExpand> |
||||
|
<TagOption value="cat5">类目五</TagOption> |
||||
|
<TagOption value="cat6">类目六</TagOption> |
||||
|
</TagExpand> |
||||
|
</TagSelect> |
||||
|
, mountNode); |
||||
|
```` |
||||
@ -0,0 +1,27 @@ |
|||||
|
--- |
||||
|
category: Components |
||||
|
type: General |
||||
|
title: TagSelect |
||||
|
subtitle: 标签选择器 |
||||
|
cols: 1 |
||||
|
--- |
||||
|
|
||||
|
倒计时组件。 |
||||
|
|
||||
|
## API |
||||
|
|
||||
|
### TagSelect |
||||
|
|
||||
|
| 参数 | 说明 | 类型 | 默认值 | |
||||
|
|----------|------------------------------------------|-------------|-------| |
||||
|
| onChange | 标签选择的回调函数 | Function(checkedTags) | | |
||||
|
|
||||
|
### TagSelect.TagOption |
||||
|
|
||||
|
| 参数 | 说明 | 类型 | 默认值 | |
||||
|
|----------|------------------------------------------|-------------|-------| |
||||
|
| value | 对应的值 | string | | |
||||
|
|
||||
|
### TagSelect.TagExpand |
||||
|
|
||||
|
包裹在 `TagSelect.TagExpand` 的元素会被折叠。 |
||||
Loading…
Reference in new issue