From 07901c84fb36bc22a08d373325ad9ca8588db37f Mon Sep 17 00:00:00 2001 From: yutent Date: Mon, 20 Nov 2023 18:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=9A=E9=80=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/checkbox.js | 12 +++++++----- src/form/radio.js | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/form/checkbox.js b/src/form/checkbox.js index 7dec373..caff6fe 100644 --- a/src/form/checkbox.js +++ b/src/form/checkbox.js @@ -37,6 +37,7 @@ class Checkbox extends Component { } else { this.value.push(ev.value) } + this.$emit('input', { data: this.value }) this.$emit('change', { data: this.value }) }) @@ -211,7 +212,7 @@ class CheckboxItem extends Component { ` ] - toggleCheck(ev) { + #toggleCheck(ev) { if (this.disabled || this.readOnly) { return } @@ -227,13 +228,14 @@ class CheckboxItem extends Component { if (this.inGroup) { this.parentNode.$emit('child-change', data) } else { + this.$emit('input', data) this.$emit('change', data) } } - handleClick(ev) { + #click(ev) { if (ev.type === 'click' || ev.keyCode === 32) { - this.toggleCheck(ev) + this.#toggleCheck(ev) } } @@ -246,8 +248,8 @@ class CheckboxItem extends Component { render() { return html`