From 4839b327b9813f2bff1b1e68b4894257460caa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Wed, 10 Mar 2021 16:52:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96input=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=9A=84lazy=E5=B1=9E=E6=80=A7;=E4=BF=AE=E5=A4=8Dbutton?= =?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/button.wc | 2 ++ src/form/input.wc | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/form/button.wc b/src/form/button.wc index 146bf9e..374311f 100644 --- a/src/form/button.wc +++ b/src/form/button.wc @@ -65,6 +65,7 @@ } :host([size='large'][circle]) { min-width: 52px; + width: 52px; height: 52px; button { @@ -81,6 +82,7 @@ } :host([size='medium'][circle]) { min-width: 44px; + width: 44px; } :host([size='small']) { width: 96px; diff --git a/src/form/input.wc b/src/form/input.wc index 039199e..48bee49 100644 --- a/src/form/input.wc +++ b/src/form/input.wc @@ -472,6 +472,7 @@ export default class Input { // 键盘事件 this._handleSubmit = $.catch(this.__INPUT__, 'keydown', ev => { let { passwd } = this.props + let now = Date.now() if (this.disabled || this.readOnly) { return @@ -491,6 +492,12 @@ export default class Input { return this._fetchSelect(this.state.mvidx, ev) } + // 并发拦截 + if (lazy && now - this.stamp < lazy) { + return + } + + this.stamp = now this.dispatchEvent(new CustomEvent('submit', { detail: this.value })) } })