Browse Source

cr vc-rate

pull/1040/head
tangjinzhou 5 years ago
parent
commit
5f41fa5e99
  1. 2
      components/form/__tests__/__snapshots__/demo.test.js.snap
  2. 510
      components/rate/__tests__/__snapshots__/demo.test.js.snap
  3. 11
      components/vc-rate/src/Rate.jsx
  4. 27
      components/vc-rate/src/Star.jsx

2
components/form/__tests__/__snapshots__/demo.test.js.snap

File diff suppressed because one or more lines are too long

510
components/rate/__tests__/__snapshots__/demo.test.js.snap

File diff suppressed because one or more lines are too long

11
components/vc-rate/src/Rate.jsx

@ -89,15 +89,16 @@ export default {
this.$emit('hoverChange', undefined);
},
onClick(event, index) {
const value = this.getStarValue(index, event.pageX);
const { allowClear, sValue: value } = this;
const newValue = this.getStarValue(index, event.pageX);
let isReset = false;
if (this.allowClear) {
isReset = value === this.sValue;
if (allowClear) {
isReset = newValue === value;
}
this.onMouseLeave(true);
this.changeValue(isReset ? 0 : value);
this.changeValue(isReset ? 0 : newValue);
this.setState({
cleanedValue: isReset ? value : null,
cleanedValue: isReset ? newValue : null,
});
},
onFocus() {

27
components/vc-rate/src/Star.jsx

@ -67,19 +67,20 @@ export default {
const character = getComponentFromProp(this, 'character');
let star = (
<li
class={this.getClassName()}
onClick={disabled ? noop : onClick}
onKeydown={disabled ? noop : onKeyDown}
onMousemove={disabled ? noop : onHover}
role="radio"
aria-checked={value > index ? 'true' : 'false'}
aria-posinset={index + 1}
aria-setsize={count}
tabIndex={0}
>
<div class={`${prefixCls}-first`}>{character}</div>
<div class={`${prefixCls}-second`}>{character}</div>
<li class={this.getClassName()}>
<div
onClick={disabled ? noop : onClick}
onKeydown={disabled ? noop : onKeyDown}
onMousemove={disabled ? noop : onHover}
role="radio"
aria-checked={value > index ? 'true' : 'false'}
aria-posinset={index + 1}
aria-setsize={count}
tabIndex={0}
>
<div class={`${prefixCls}-first`}>{character}</div>
<div class={`${prefixCls}-second`}>{character}</div>
</div>
</li>
);
if (characterRender) {

Loading…
Cancel
Save