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);
|
this.$emit('hoverChange', undefined);
|
||||||
},
|
},
|
||||||
onClick(event, index) {
|
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;
|
let isReset = false;
|
||||||
if (this.allowClear) {
|
if (allowClear) {
|
||||||
isReset = value === this.sValue;
|
isReset = newValue === value;
|
||||||
}
|
}
|
||||||
this.onMouseLeave(true);
|
this.onMouseLeave(true);
|
||||||
this.changeValue(isReset ? 0 : value);
|
this.changeValue(isReset ? 0 : newValue);
|
||||||
this.setState({
|
this.setState({
|
||||||
cleanedValue: isReset ? value : null,
|
cleanedValue: isReset ? newValue : null,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onFocus() {
|
onFocus() {
|
||||||
|
|
|
@ -67,19 +67,20 @@ export default {
|
||||||
|
|
||||||
const character = getComponentFromProp(this, 'character');
|
const character = getComponentFromProp(this, 'character');
|
||||||
let star = (
|
let star = (
|
||||||
<li
|
<li class={this.getClassName()}>
|
||||||
class={this.getClassName()}
|
<div
|
||||||
onClick={disabled ? noop : onClick}
|
onClick={disabled ? noop : onClick}
|
||||||
onKeydown={disabled ? noop : onKeyDown}
|
onKeydown={disabled ? noop : onKeyDown}
|
||||||
onMousemove={disabled ? noop : onHover}
|
onMousemove={disabled ? noop : onHover}
|
||||||
role="radio"
|
role="radio"
|
||||||
aria-checked={value > index ? 'true' : 'false'}
|
aria-checked={value > index ? 'true' : 'false'}
|
||||||
aria-posinset={index + 1}
|
aria-posinset={index + 1}
|
||||||
aria-setsize={count}
|
aria-setsize={count}
|
||||||
tabIndex={0}
|
tabIndex={0}
|
||||||
>
|
>
|
||||||
<div class={`${prefixCls}-first`}>{character}</div>
|
<div class={`${prefixCls}-first`}>{character}</div>
|
||||||
<div class={`${prefixCls}-second`}>{character}</div>
|
<div class={`${prefixCls}-second`}>{character}</div>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
);
|
);
|
||||||
if (characterRender) {
|
if (characterRender) {
|
||||||
|
|
Loading…
Reference in New Issue