From a5f41b5d98f23d618dc7519c605ce943b114dfd5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 13 十一月 2023 18:07:51 +0800 Subject: [PATCH] 2023-11-13 --- src/tabviews/zshare/mutilform/mkNumberInput/index.jsx | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx b/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx index 68e1a62..c517566 100644 --- a/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx +++ b/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx @@ -40,16 +40,36 @@ if (type === 'focus') { let node = document.getElementById(uuid) - node.select() + node && node.select() } else if (type === 'input') { this.setState({value}) this.props.onChange(value, true) + } else if (type === 'reset') { + let _val = this.props.config.initval + + this.setState({value: _val}, () => { + let node = document.getElementById(this.props.config.uuid) + node && node.select() + }) + + this.props.onChange(_val) } } handleChange = (val) => { this.setState({value: val}) - this.props.onChange(val) + + let _val = val + + if (typeof(_val) !== 'number') { + _val = parseFloat(_val) + + if (isNaN(_val)) { + _val = '' + } + } + + this.props.onChange(_val) } handleSubmit = () => { -- Gitblit v1.8.0