From 7654fc8da71186db8f084bd711b0ceaeb9c42768 Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 29 Nov 2023 13:42:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=BC=98=E5=8C=96number?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/number.js | 52 +++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/src/form/number.js b/src/form/number.js index 37e332b..50bbac6 100644 --- a/src/form/number.js +++ b/src/form/number.js @@ -106,39 +106,13 @@ class InputNumber extends Component { `, // 尺寸 css` - @use 'sass:map'; - $sizes: ( - s: ( - w: 52px, - h: 20px, - f: 12px - ), - m: ( - w: 72px, - h: 24px, - f: 12px - ), - xl: ( - w: 132px, - h: 36px, - f: 14px - ), - xxl: ( - w: 160px, - h: 44px, - f: 16px - ) - ); + :host([size='small']) { + min-width: 72px; + height: 24px; + font-size: 12px; - @loop $s, $v in $sizes { - :host([size='#{$s}']) { - min-width: map.get($v, 'w'); - height: map.get($v, 'h'); - font-size: map.get($v, 'f'); - - button { - width: map.get($v, 'h') + 2; - } + button { + width: 26px; } } @@ -160,9 +134,7 @@ class InputNumber extends Component { info: 'blue', success: 'green', warning: 'orange', - danger: 'red', - secondary: 'dark', - help: 'grey' + danger: 'red' ); @loop $t, $c in $colors { @@ -225,7 +197,17 @@ class InputNumber extends Component { } #fetch(value) { + let now = Date.now() + let { lazy } = this this.value = value + + // 并发拦截 + if (lazy && now - this.#stamp < lazy) { + return + } + + this.#stamp = now + this.$emit('input') this.$emit('change') }