mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 01:13:58 +08:00
docs: add input showCount lose focus desc. close #35080
This commit is contained in:
parent
1349b99122
commit
5dfa8678c0
@ -96,9 +96,9 @@ Supports all props of `Input`.
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why Input lose focus when change `prefix/suffix`
|
||||
### Why Input lose focus when change `prefix/suffix/showCount`
|
||||
|
||||
When Input dynamic add or remove `prefix/suffix` will make React recreate the dom structure and new input will be not focused. You can set an empty `<span />` element to keep the dom structure:
|
||||
When Input dynamic add or remove `prefix/suffix/showCount` will make React recreate the dom structure and new input will be not focused. You can set an empty `<span />` element to keep the dom structure:
|
||||
|
||||
```jsx
|
||||
const suffix = condition ? <Icon type="smile" /> : <span />;
|
||||
|
@ -97,9 +97,9 @@ Input 的其他属性和 React 自带的 [input](https://reactjs.org/docs/dom-el
|
||||
|
||||
## FAQ
|
||||
|
||||
### 为什么我动态改变 `prefix/suffix` 时,Input 会失去焦点?
|
||||
### 为什么我动态改变 `prefix/suffix/showCount` 时,Input 会失去焦点?
|
||||
|
||||
当 Input 动态添加或者删除 `prefix/suffix` 时,React 会重新创建 DOM 结构而新的 input 是没有焦点的。你可以预设一个空的 `<span />` 来保持 DOM 结构不变:
|
||||
当 Input 动态添加或者删除 `prefix/suffix/showCount` 时,React 会重新创建 DOM 结构而新的 input 是没有焦点的。你可以预设一个空的 `<span />` 来保持 DOM 结构不变:
|
||||
|
||||
```jsx
|
||||
const suffix = condition ? <Icon type="smile" /> : <span />;
|
||||
|
Loading…
Reference in New Issue
Block a user