fix
parent
9d7169bf7b
commit
a074865dee
|
@ -9,7 +9,7 @@
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:prefix-cls="`${prefixCls}-star`"
|
:prefix-cls="`${prefixCls}-star`"
|
||||||
:allowHalf="allowHalf"
|
:allowHalf="allowHalf"
|
||||||
:value="hoverValue"
|
:value="currentValue"
|
||||||
@onClick="onClick"
|
@onClick="onClick"
|
||||||
@onHover="onHover"
|
@onHover="onHover"
|
||||||
:key="i">
|
:key="i">
|
||||||
|
@ -69,7 +69,7 @@ export default {
|
||||||
const { value, defaultValue } = this
|
const { value, defaultValue } = this
|
||||||
const reValue = value === undefined ? defaultValue : value
|
const reValue = value === undefined ? defaultValue : value
|
||||||
return {
|
return {
|
||||||
hoverValue: reValue,
|
currentValue: reValue,
|
||||||
stateValue: reValue,
|
stateValue: reValue,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -91,9 +91,9 @@ export default {
|
||||||
this.onChange(clValue)
|
this.onChange(clValue)
|
||||||
},
|
},
|
||||||
onHover (event, index) {
|
onHover (event, index) {
|
||||||
this.hoverValue = this.getStarValue(index, event.pageX)
|
this.currentValue = this.getStarValue(index, event.pageX)
|
||||||
this.changeValue(this.hoverValue)
|
this.changeValue(this.currentValue)
|
||||||
this.onHoverChange(this.hoverValue)
|
this.onHoverChange(this.currentValue)
|
||||||
},
|
},
|
||||||
getStarDOM (index) {
|
getStarDOM (index) {
|
||||||
return this.$refs.stars[index].$el
|
return this.$refs.stars[index].$el
|
||||||
|
@ -110,20 +110,19 @@ export default {
|
||||||
return value
|
return value
|
||||||
},
|
},
|
||||||
onMouseLeave () {
|
onMouseLeave () {
|
||||||
this.hoverValue = undefined
|
this.currentValue = undefined
|
||||||
this.changeValue()
|
this.changeValue()
|
||||||
this.onHoverChange()
|
this.onHoverChange()
|
||||||
},
|
},
|
||||||
changeValue (val) {
|
changeValue (val) {
|
||||||
if (val === undefined) {
|
if (val === undefined) {
|
||||||
this.hoverValue = this.stateValue
|
this.currentValue = this.stateValue
|
||||||
return
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
value (val = 0) {
|
value (val = 0) {
|
||||||
this.hoverValue = this.stateValue = val
|
this.currentValue = this.stateValue = val
|
||||||
this.$emit('input', val)
|
this.$emit('input', val)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue