From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 09 十二月 2022 15:53:32 +0800 Subject: [PATCH] 2022-12-09 --- src/tabviews/zshare/mutilform/mkNumberInput/index.jsx | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx b/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx index 4b690c8..47a1840 100644 --- a/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx +++ b/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx @@ -37,6 +37,7 @@ mkFormHandle = (type, uuid, value) => { if (uuid !== this.props.config.uuid) return + if (type === 'focus') { let node = document.getElementById(uuid) node.select() @@ -48,7 +49,18 @@ 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