Skip to content

Commit

Permalink
fix(color-picker): can't input 0 as unit's value, closes #2680
Browse files Browse the repository at this point in the history
  • Loading branch information
07akioni committed Mar 26, 2022
1 parent 214cf5e commit b4a0fe2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Fix `n-popconfirm` doesn't has `setShow` & `syncPosition` methods.
- Fix `n-popselect` doesn't has `setShow` & `syncPosition` methods.
- Fix `n-menu` theme's peers missing `Dropdown`.
- Fix `n-color-picker` can't input 0 as unit's value, closes [#2680](https://github.com/TuSimple/naive-ui/issues/2680)

### Feats

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- 修复 `n-popconfirm` 缺少 `setShow``syncPosition` 方法
- 修复 `n-popselect` 缺少 `setShow``syncPosition` 方法
- 修复 `n-menu` 主题 peers 缺少 `Dropdown`
- 修复 `n-color-picker` 不能输入 0 作为单位的值,关闭 [#2680](https://github.com/TuSimple/naive-ui/issues/2680)

### Feats

Expand Down
8 changes: 4 additions & 4 deletions src/color-picker/src/ColorInputUnit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default defineComponent({
break
case 'H':
unit = normalizeHueUnit(value)
if (!unit) {
if (unit === false) {
inputValueRef.value = getInputString()
} else {
props.onUpdateValue(unit)
Expand All @@ -108,15 +108,15 @@ export default defineComponent({
case 'L':
case 'V':
unit = normalizeSlvUnit(value)
if (!unit) {
if (unit === false) {
inputValueRef.value = getInputString()
} else {
props.onUpdateValue(unit)
}
break
case 'A':
unit = normalizeAlphaUnit(value)
if (!unit) {
if (unit === false) {
inputValueRef.value = getInputString()
} else {
props.onUpdateValue(unit)
Expand All @@ -126,7 +126,7 @@ export default defineComponent({
case 'G':
case 'B':
unit = normalizeRgbUnit(value)
if (!unit) {
if (unit === false) {
inputValueRef.value = getInputString()
} else {
props.onUpdateValue(unit)
Expand Down

0 comments on commit b4a0fe2

Please sign in to comment.