|
| 1 | +# rc-rate |
| 2 | +--- |
| 3 | + |
| 4 | +React Rate Component |
| 5 | + |
| 6 | + |
| 7 | +[![NPM version][npm-image]][npm-url] |
| 8 | +[![build status][travis-image]][travis-url] |
| 9 | +[![Test coverage][coveralls-image]][coveralls-url] |
| 10 | +[![gemnasium deps][gemnasium-image]][gemnasium-url] |
| 11 | +[![node version][node-image]][node-url] |
| 12 | +[![npm download][download-image]][download-url] |
| 13 | +[](https://saucelabs.com/u/rc-rate) |
| 14 | + |
| 15 | +[](https://saucelabs.com/u/rc-rate) |
| 16 | + |
| 17 | +[npm-image]: http://img.shields.io/npm/v/rc-rate.svg?style=flat-square |
| 18 | +[npm-url]: http://npmjs.org/package/rc-rate |
| 19 | +[travis-image]: https://img.shields.io/travis/react-component/rate.svg?style=flat-square |
| 20 | +[travis-url]: https://travis-ci.org/react-component/rate |
| 21 | +[coveralls-image]: https://img.shields.io/coveralls/react-component/rate.svg?style=flat-square |
| 22 | +[coveralls-url]: https://coveralls.io/r/react-component/rate?branch=master |
| 23 | +[gemnasium-image]: http://img.shields.io/gemnasium/react-component/rate.svg?style=flat-square |
| 24 | +[gemnasium-url]: https://gemnasium.com/react-component/rate |
| 25 | +[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square |
| 26 | +[node-url]: http://nodejs.org/download/ |
| 27 | +[download-image]: https://img.shields.io/npm/dm/rc-rate.svg?style=flat-square |
| 28 | +[download-url]: https://npmjs.org/package/rc-rate |
| 29 | + |
| 30 | + |
| 31 | +## Browser Support |
| 32 | + |
| 33 | +| |  |  |  | | |
| 34 | +| --- | --- | --- | --- | --- | |
| 35 | +| IE 8+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ | |
| 36 | + |
| 37 | +## Screenshots |
| 38 | + |
| 39 | +<img src="" width="288"/> |
| 40 | + |
| 41 | + |
| 42 | +## Development |
| 43 | + |
| 44 | +``` |
| 45 | +npm install |
| 46 | +npm start |
| 47 | +``` |
| 48 | + |
| 49 | +## Example |
| 50 | + |
| 51 | +http://localhost:8000/examples/ |
| 52 | + |
| 53 | + |
| 54 | +online example: http://react-component.github.io/rate/examples/ |
| 55 | + |
| 56 | + |
| 57 | +## Feature |
| 58 | + |
| 59 | +* support ie8,ie8+,chrome,firefox,safari |
| 60 | + |
| 61 | +### Keyboard |
| 62 | + |
| 63 | + |
| 64 | +## install |
| 65 | + |
| 66 | + |
| 67 | +[](https://npmjs.org/package/rc-rate) |
| 68 | + |
| 69 | + |
| 70 | +## Usage |
| 71 | + |
| 72 | +```js |
| 73 | +var Rate = require('rc-rate'); |
| 74 | +var React = require('react'); |
| 75 | +React.render(<Rate />, container); |
| 76 | +``` |
| 77 | + |
| 78 | +## API |
| 79 | + |
| 80 | +### props |
| 81 | + |
| 82 | +<table class="table table-bordered table-striped"> |
| 83 | + <thead> |
| 84 | + <tr> |
| 85 | + <th style="width: 100px;">name</th> |
| 86 | + <th style="width: 50px;">type</th> |
| 87 | + <th style="width: 50px;">default</th> |
| 88 | + <th>description</th> |
| 89 | + </tr> |
| 90 | + </thead> |
| 91 | + <tbody> |
| 92 | + <tr> |
| 93 | + <td>starNum</td> |
| 94 | + <td>number</td> |
| 95 | + <td>5</td> |
| 96 | + <td>总共需要显示星星的数量</td> |
| 97 | + </tr> |
| 98 | + <tr> |
| 99 | + <td>initNum</td> |
| 100 | + <td>number</td> |
| 101 | + <td>0</td> |
| 102 | + <td>起始高亮星星的数值</td> |
| 103 | + </tr> |
| 104 | + <tr> |
| 105 | + <td>half</td> |
| 106 | + <td>bool</td> |
| 107 | + <td>false</td> |
| 108 | + <td>是否支持半颗星的情况</td> |
| 109 | + </tr> |
| 110 | + <tr> |
| 111 | + <td>style</td> |
| 112 | + <td>object</td> |
| 113 | + <td>{}</td> |
| 114 | + <td>星星的样式必须符合react的style样式</td> |
| 115 | + </tr> |
| 116 | + <tr> |
| 117 | + <td>color</td> |
| 118 | + <td>string</td> |
| 119 | + <td>"#ff8208"</td> |
| 120 | + <td>星星的颜色,默认黄色</td> |
| 121 | + </tr> |
| 122 | + <tr> |
| 123 | + <td>size</td> |
| 124 | + <td>number</td> |
| 125 | + <td>15</td> |
| 126 | + <td>默认星星的大小,默认15px</td> |
| 127 | + </tr> |
| 128 | + <tr> |
| 129 | + <td>useHover</td> |
| 130 | + <td>bool</td> |
| 131 | + <td>false</td> |
| 132 | + <td>是否支持hover选择数量(必须disableHover为false的情况下,会覆盖click事件),</td> |
| 133 | + </tr> |
| 134 | + <tr> |
| 135 | + <td>disableHover</td> |
| 136 | + <td>bool</td> |
| 137 | + <td>false</td> |
| 138 | + <td>是否不开启点击事件</td> |
| 139 | + </tr> |
| 140 | + <tr> |
| 141 | + <td>disableClick</td> |
| 142 | + <td>bool</td> |
| 143 | + <td>false</td> |
| 144 | + <td>是否不开启hover事件</td> |
| 145 | + </tr> |
| 146 | + <tr> |
| 147 | + <td>onHover</td> |
| 148 | + <td>func</td> |
| 149 | + <td>function(){}</td> |
| 150 | + <td>鼠标在星星上移动的时候的事件</td> |
| 151 | + </tr> |
| 152 | + <tr> |
| 153 | + <td>onClick</td> |
| 154 | + <td>bool</td> |
| 155 | + <td>false</td> |
| 156 | + <td>鼠标点击星星的时候的事件</td> |
| 157 | + </tr> |
| 158 | + <tr> |
| 159 | + <td>onChange</td> |
| 160 | + <td>bool</td> |
| 161 | + <td>false</td> |
| 162 | + <td>星星变化时候的事件</td> |
| 163 | + </tr> |
| 164 | + </tbody> |
| 165 | +</table> |
| 166 | + |
| 167 | + |
| 168 | +## Test Case |
| 169 | + |
| 170 | +http://localhost:8000/tests/runner.html?coverage |
| 171 | + |
| 172 | +## Coverage |
| 173 | + |
| 174 | +http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage |
| 175 | + |
| 176 | +## License |
| 177 | + |
| 178 | +rc-rate is released under the MIT license. |
0 commit comments