diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 5c2c913c35f..d8423afaf4e 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,7 @@ ### Fixes - `n-select` can't input in filterable mode in single mode in iOS Safari, closes [#230](https://github.com/TuSimple/naive-ui/issues/230) +- `n-input-number` doesn't change with /- buttons if you delete its content at least once, closes [#251](https://github.com/TuSimple/naive-ui/issues/251) ## 2.13.0 (2021-06-21) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index b0f187996b5..de9e446d88d 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,7 @@ ### Fixes - `n-select` 在可过滤单选模式下在 iOS Safari 无法输入,关闭 [#230](https://github.com/TuSimple/naive-ui/issues/230) +- 修复 `n-input-number` 至少删除一次输入框内容,则 input-number 不会随 +/- 按钮更改,关闭 [#251](https://github.com/TuSimple/naive-ui/issues/251) ## 2.13.0 (2021-06-21) diff --git a/src/input-number/src/utils.ts b/src/input-number/src/utils.ts index e9ae998b678..b13e232396f 100644 --- a/src/input-number/src/utils.ts +++ b/src/input-number/src/utils.ts @@ -1,11 +1,7 @@ // string => string (expected, not implemented) // string => number (legacy) export function parse (value: string): number | null { - if ( - value === undefined || - value === null || - (typeof value === 'string' && value.trim() === '') - ) { + if (value === undefined || value === null) { return null } return Number(value)