mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
docs(input): focus & blur manually
This commit is contained in:
parent
ad4c055dc2
commit
f61990c139
@ -76,7 +76,7 @@ tree
|
||||
|
||||
这些方法可以帮助你在非受控的状态下改变表格,但是,并不推荐在异步的状况下使用这些方法。如果需要异步操作,最好用**受控**的方式使用表格。
|
||||
|
||||
| 名称 | 参数 | 说明 |
|
||||
| 名称 | 类型 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| clearFilters | `() => void` | 清空所有的 filter 状态 |
|
||||
| clearSorter | `() => void` | 清空所有的 sort 状态 |
|
||||
|
30
src/input/demos/enUS/focus.demo.md
Normal file
30
src/input/demos/enUS/focus.demo.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Focus & Blur Manually
|
||||
|
||||
```html
|
||||
<n-space vertical>
|
||||
<n-space>
|
||||
<n-button @click="handleFocus">Focus</n-button>
|
||||
<n-button :focusable="false" @click="handleBlur">Blur</n-button>
|
||||
</n-space>
|
||||
<n-input ref="inputInstRef" />
|
||||
</n-space>
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
setup () {
|
||||
const inputInstRef = ref(null)
|
||||
return {
|
||||
inputInstRef,
|
||||
handleFocus () {
|
||||
inputInstRef.value.focus()
|
||||
},
|
||||
handleBlur () {
|
||||
inputInstRef.value.blur()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
@ -17,6 +17,7 @@ pair
|
||||
input-group
|
||||
passively-activated
|
||||
count
|
||||
focus
|
||||
```
|
||||
|
||||
## Props
|
||||
@ -72,3 +73,12 @@ count
|
||||
| Name | Parameters | Description |
|
||||
| ------- | ---------- | ----------- |
|
||||
| default | `()` | |
|
||||
|
||||
## Methods
|
||||
|
||||
### Input Methods
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----- | ---------- | -------------------- |
|
||||
| blur | () => void | Blur input element. |
|
||||
| focus | () => void | Focus input element. |
|
||||
|
30
src/input/demos/zhCN/focus.demo.md
Normal file
30
src/input/demos/zhCN/focus.demo.md
Normal file
@ -0,0 +1,30 @@
|
||||
# 手动 Focus & Blur
|
||||
|
||||
```html
|
||||
<n-space vertical>
|
||||
<n-space>
|
||||
<n-button @click="handleFocus">Focus</n-button>
|
||||
<n-button :focusable="false" @click="handleBlur">Blur</n-button>
|
||||
</n-space>
|
||||
<n-input ref="inputInstRef" />
|
||||
</n-space>
|
||||
```
|
||||
|
||||
```js
|
||||
import { defineComponent, ref } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
setup () {
|
||||
const inputInstRef = ref(null)
|
||||
return {
|
||||
inputInstRef,
|
||||
handleFocus () {
|
||||
inputInstRef.value.focus()
|
||||
},
|
||||
handleBlur () {
|
||||
inputInstRef.value.blur()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
```
|
@ -17,6 +17,7 @@ pair
|
||||
input-group
|
||||
passively-activated
|
||||
count
|
||||
focus
|
||||
```
|
||||
|
||||
## Props
|
||||
@ -73,3 +74,12 @@ count
|
||||
| 属性 | 类型 | 说明 |
|
||||
| ------- | ---- | ---- |
|
||||
| default | `()` | |
|
||||
|
||||
## Methods
|
||||
|
||||
### Input Methods
|
||||
|
||||
| 名称 | 类型 | 说明 |
|
||||
| ----- | ---------- | ---------------- |
|
||||
| blur | () => void | Blur input 元素 |
|
||||
| focus | () => void | Focus input 元素 |
|
||||
|
@ -85,7 +85,6 @@ const inputProps = {
|
||||
},
|
||||
autofocus: Boolean,
|
||||
inputProps: Object as PropType<TextareaHTMLAttributes | InputHTMLAttributes>,
|
||||
|
||||
resizable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
Loading…
Reference in New Issue
Block a user