解决 cl-input-number 首次触发 onChange 的问题

This commit is contained in:
icssoa
2025-08-20 17:32:55 +08:00
parent 3200ab2bf8
commit 717d8cf932
3 changed files with 14 additions and 8 deletions

View File

@@ -226,13 +226,14 @@ function update() {
val = parseFloat(val.toFixed(2));
}
// 更新绑定
if (val != value.value) {
value.value = val;
}
// 更新值,确保值是数字
value.value = val;
emit("update:modelValue", val);
emit("change", val);
// 如果值发生变化,则触发事件
if (val != props.modelValue) {
emit("update:modelValue", val);
emit("change", val);
}
});
}