From 28877df64acaa539a13873a20c3b9eb76e3501a6 Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 26 May 2023 00:06:18 +0800 Subject: [PATCH] =?UTF-8?q?switch=E5=92=8Cstar=E7=BB=84=E4=BB=B6=E5=85=BC?= =?UTF-8?q?=E5=AE=B9vue3=E7=9A=84=E5=8F=8C=E5=90=91=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/star.js | 1 + src/form/switch.js | 5 +++-- src/pager/index.js | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/form/star.js b/src/form/star.js index 52bd9d1..08276b2 100644 --- a/src/form/star.js +++ b/src/form/star.js @@ -171,6 +171,7 @@ class Star extends Component { } else { this.value = tmp.i + tmp.f } + this.$emit('input', { value: this.value }) this.$emit('change', { value: this.value }) } } diff --git a/src/form/switch.js b/src/form/switch.js index 8ee6b3b..3a229dc 100644 --- a/src/form/switch.js +++ b/src/form/switch.js @@ -11,8 +11,7 @@ class Switch extends Component { size: 'l', value: { type: Boolean, - default: false, - attribute: false + default: false }, inactiveText: '', activeText: '', @@ -195,11 +194,13 @@ class Switch extends Component { value: this.value } + this.$emit('input') this.$emit('change', data) } handleClick(ev) { if (ev.type === 'click' || ev.keyCode === 32) { + ev.preventDefault() this.toggleCheck(ev) } } diff --git a/src/pager/index.js b/src/pager/index.js index 9191415..b3b9182 100644 --- a/src/pager/index.js +++ b/src/pager/index.js @@ -243,7 +243,8 @@ class Pager extends Component { this.page = num - this.$emit('page-changed', { data: num }) + console.log(this) + this.$emit('page-change', { data: num }) } } @@ -252,9 +253,9 @@ class Pager extends Component { let n = +ev.target.value if (n === n) { this.page = n - this.$emit('page-changed', { data: this.page }) + this.$emit('page-change', { data: n }) } - ev.target.value = this.page + ev.target.value = n } }