mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
add rate
This commit is contained in:
parent
f80570d53b
commit
8c3a70ab0b
15
components/rate/demo/basic.md
Normal file
15
components/rate/demo/basic.md
Normal file
@ -0,0 +1,15 @@
|
||||
# 基本
|
||||
|
||||
- order: 0
|
||||
|
||||
最简单的用法。
|
||||
|
||||
---
|
||||
|
||||
````jsx
|
||||
import { Rate } from 'antd';
|
||||
|
||||
ReactDOM.render(
|
||||
<Rate allowHalf />
|
||||
, mountNode);
|
||||
````
|
14
components/rate/index.jsx
Normal file
14
components/rate/index.jsx
Normal file
@ -0,0 +1,14 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import RcRate from 'rc-rate';
|
||||
|
||||
export default class Affix extends React.Component {
|
||||
static propTypes = {
|
||||
prefixCls: PropTypes.string,
|
||||
};
|
||||
static defaultProps= {
|
||||
prefixCls: 'ant-rate',
|
||||
};
|
||||
render() {
|
||||
return <RcRate {...this.props} />;
|
||||
}
|
||||
}
|
20
components/rate/index.md
Normal file
20
components/rate/index.md
Normal file
@ -0,0 +1,20 @@
|
||||
# Rate
|
||||
|
||||
- category: Components
|
||||
- chinese: 评分
|
||||
- type: 表单
|
||||
|
||||
---
|
||||
|
||||
评分组件。
|
||||
|
||||
## API
|
||||
|
||||
|
||||
| 成员 | 说明 | 类型 | 默认值 |
|
||||
|-------------|----------------|--------------------|--------------|
|
||||
| count | star 个数 | Number | 5 |
|
||||
| value | 受控值 | Number | |
|
||||
| defaultValue | 默认值 | Number | |
|
||||
| onChange(value: Number) | 回调 | Function | |
|
||||
| allowHalf | 是否允许半选 | Boolean | |
|
1
index.js
1
index.js
@ -1,6 +1,7 @@
|
||||
// this file is not used if use https://github.com/ant-design/babel-plugin-antd
|
||||
|
||||
const antd = {
|
||||
Rate: require('./components/rate'),
|
||||
Affix: require('./components/affix'),
|
||||
DatePicker: require('./components/date-picker'),
|
||||
Tooltip: require('./components/tooltip'),
|
||||
|
@ -52,6 +52,7 @@
|
||||
"rc-progress": "~1.0.4",
|
||||
"rc-queue-anim": "~0.11.2",
|
||||
"rc-radio": "~2.0.0",
|
||||
"rc-rate": "~1.1.0",
|
||||
"rc-select": "~6.0.1",
|
||||
"rc-slider": "~3.5.1",
|
||||
"rc-steps": "~1.4.1",
|
||||
|
@ -41,3 +41,4 @@
|
||||
@import "transfer";
|
||||
@import "cascader";
|
||||
@import "card";
|
||||
@import "rate";
|
||||
|
58
style/components/rate.less
Normal file
58
style/components/rate.less
Normal file
@ -0,0 +1,58 @@
|
||||
|
||||
@rate-prefix-cls: ant-rate;
|
||||
|
||||
.@{rate-prefix-cls} {
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
font-size: 28px;
|
||||
display: inline-block;
|
||||
font-family: 'anticon';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
cursor: pointer;
|
||||
-webkit-font-smoothing: antialiased; /*解决safair和chrome被加粗*/
|
||||
-webkit-text-stroke-width: 0.2px; /*解决chrome锯齿*/
|
||||
|
||||
&-disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&-star {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
position: relative;
|
||||
|
||||
&-content {
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
&:before {
|
||||
content: "\E694";
|
||||
}
|
||||
}
|
||||
|
||||
&-half:before {
|
||||
content: "\E693";
|
||||
}
|
||||
|
||||
&-half &-content {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&-full:before {
|
||||
content: "\E694";
|
||||
}
|
||||
|
||||
&-zero:before {
|
||||
content: "\E693";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user