perf(components): [slider] emit UPDATE_MODEL_EVENT only if value changes (#8603)

This commit is contained in:
bqy_fe 2022-07-08 21:30:53 +08:00 committed by GitHub
parent 9781552a2e
commit e939850863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -251,7 +251,10 @@ export const useSliderButton = (
let value =
steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value
value = Number.parseFloat(value.toFixed(precision.value))
emit(UPDATE_MODEL_EVENT, value)
if (value !== props.modelValue) {
emit(UPDATE_MODEL_EVENT, value)
}
if (!initData.dragging && props.modelValue !== initData.oldValue) {
initData.oldValue = props.modelValue