Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(input): clearable bug while use chinese input #979

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Pending


### Feats

- `n-cascader` add `onUpdateValue` prop.
Expand All @@ -14,6 +15,7 @@

- Fix `n-layout`'s `sider-placement` doesn't work after build, closes [#978](https://github.com/TuSimple/naive-ui/issues/978).
- Fix `n-input-number`'s `step` calculate error when the value is decimal, closes [#1007](https://github.com/TuSimple/naive-ui/issues/1007).
- Fix `n-input` chinese input method not correct while mouse leave the input in `clearable` is true, closes [#905](https://github.com/TuSimple/naive-ui/issues/905).

## 2.16.7 (2021-08-27)

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Pending


### Feats

- `n-cascader` 新增 `onUpdateValue` 方法
Expand All @@ -14,6 +15,7 @@

- 修复 `n-layout` 的 `sider-placement` 属性在打包之后不生效,关闭 [#978](https://github.com/TuSimple/naive-ui/issues/978)
- 修复 `n-input-number` 的 `step` 值为小数时计算错误,关闭 [#1007](https://github.com/TuSimple/naive-ui/issues/1007)
- 修复 `n-input` 在 `clearable` 为 `true` 时鼠标离开输入框时中文输入法不正确的问题,关闭 [#905](https://github.com/TuSimple/naive-ui/issues/905)

## 2.16.7 (2021-08-27)

Expand Down
5 changes: 4 additions & 1 deletion src/input/src/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,10 @@ export default defineComponent({
hoverRef.value = true
}
function handleMouseLeave (): void {
hoverRef.value = false
// FIX: https://github.com/TuSimple/naive-ui/issues/905
if (!isComposingRef.value) {
hoverRef.value = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我发现这个 hoverRef.value 会影响 showClearButton,这不是正确的改法,想要避免 rerender 需要 useMemo

}
}
function handlePasswordToggleClick (): void {
if (mergedDisabledRef.value) return
Expand Down