cr vc-rate
parent
413b9b19bd
commit
5f41fa5e99
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -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() {
|
||||
|
|
|
@ -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…
Reference in New Issue