From da64ab0923bf8817fc8599a6e37b953ce38f64c8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期日, 27 八月 2023 18:37:36 +0800 Subject: [PATCH] 2023-08-27 --- src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx b/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx index 5c0bfe3..05fb8a7 100644 --- a/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx +++ b/src/tabviews/zshare/actionList/normalbutton/mkcounter/index.jsx @@ -48,7 +48,7 @@ this.timer = setTimeout(() => { this.props.onChange(val) - }, 1000) + }, btn.formType === 'count_line' ? 100 : 500) } plus = () => { @@ -71,7 +71,7 @@ this.timer = setTimeout(() => { this.props.onChange(val) - }, 1000) + }, btn.formType === 'count_line' ? 100 : 500) } submit = () => { @@ -96,7 +96,21 @@ this.timer = setTimeout(() => { this.props.onChange(count) - }, 1000) + }, btn.formType === 'count_line' ? 100 : 500) + } + + onChange = (val) => { + const { btn } = this.props + + this.setState({count: val}) + + if (btn.formType === 'count_line' && typeof(val) === 'number') { + clearTimeout(this.timer) + + this.timer = setTimeout(() => { + this.props.onChange(val) + }, 100) + } } render() { @@ -106,7 +120,7 @@ return ( <div onClick={(e) => e.stopPropagation()} className={'mk-btn-counter ' + (btn.size || '') + (disabled ? ' mk-disabled' : '')} style={btn.style}> <span onClick={this.minus}><MinusOutlined /></span> - <span><InputNumber value={count} onChange={(val) => this.setState({count: val})} onBlur={this.submit} onPressEnter={this.submit}/></span> + <span><InputNumber value={count} onChange={this.onChange} onBlur={this.submit} onPressEnter={this.submit}/></span> <span onClick={this.plus}><PlusOutlined /></span> </div> ) -- Gitblit v1.8.0