king
2023-08-27 da64ab0923bf8817fc8599a6e37b953ce38f64c8
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>
    )