fix(sl-range): add value change handler (#572)

This commit is contained in:
Denis Korablev
2021-10-19 17:48:39 +04:00
committed by GitHub
parent 72f2cbe9e8
commit 25aa8318d9

View File

@@ -138,6 +138,17 @@ export default class SlRange extends LitElement {
emit(this, 'sl-blur');
}
@watch('value', { waitUntilFirstUpdate: true })
handleValueChange() {
this.value = Number(this.value);
if (this.input) {
this.invalid = !this.input.checkValidity();
}
requestAnimationFrame(() => this.syncRange());
}
@watch('disabled')
handleDisabledChange() {
// Disabled form controls are always valid, so we need to recheck validity when the state changes