mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-03-25 14:10:50 +08:00
feat(dialog): useDialog supports onEsc
prop
This commit is contained in:
parent
dc9e871996
commit
a31592bb6e
@ -33,6 +33,7 @@
|
||||
- `n-transfer` add `render-target-label` prop.
|
||||
- `n-transfer` add `render-source-list` prop.
|
||||
- `n-scrollbar` supports RTL.
|
||||
- `useDialog` supports `onEsc` prop.
|
||||
|
||||
## 2.31.0
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
- `n-transfer` 新增 `render-target-label` 属性
|
||||
- `n-transfer` 新增 `render-source-list` 属性
|
||||
- `n-scrollbar` 支持 RTL
|
||||
- `useDialog` 支持 `onEsc` 属性
|
||||
|
||||
## 2.31.0
|
||||
|
||||
|
@ -58,7 +58,7 @@ action.vue
|
||||
### DialogOptions Properties
|
||||
|
||||
| Name | Type | Default | Description | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| action | `() => VNodeChild` | `undefined` | Content of the operation area, must be a `render` function. | |
|
||||
| autoFocus | `boolean` | `true` | Whether to focus the first focusable element inside modal. | 2.28.3 |
|
||||
| blockScroll | `boolean` | `true` | Whether to disabled body scrolling when it's active. | 2.28.3 |
|
||||
@ -106,6 +106,7 @@ All the properties can be modified dynamically.
|
||||
| title | `string \| (() => VNodeChild)` | Can be a `render` function. | |
|
||||
| type | `'error \| 'success' \| 'warning'` | Dialog type. | |
|
||||
| onClose | `() => boolean \| Promise<boolean> \| any` | The default behavior is closing the confirm. Return `false` or `resolve false` or `Promise rejected` will prevent the default behavior. | |
|
||||
| onEsc | `() => void` | Callback fired when the escape key is pressed and focus is within dialog. | NEXT_VERSION |
|
||||
| onNegativeClick | `(e: MouseEvent) => boolean \| Promise<boolean> \| any` | The default behavior is closing the confirm. Return `false` or `resolve false` or `Promise rejected` will prevent the default behavior. | |
|
||||
| onPositiveClick | `(e: MouseEvent) => boolean \| Promise<boolean> \| any` | The default behavior is closing the confirm. Return `false` or `resolve false` or `Promise rejected` will prevent the default behavior. | |
|
||||
|
||||
|
@ -108,6 +108,7 @@ focus-debug.vue
|
||||
| title | `string \| (() => VNodeChild)` | 可以是 `render` 函数 | |
|
||||
| type | `'error \| 'success' \| 'warning'` | 对话框类型 | |
|
||||
| onClose | `() => boolean \| Promise<boolean> \| any` | 默认行为是关闭确认框。返回 `false` 或者 resolve `false` 或者 `Promise` 被 `reject` 会避免默认行为 | |
|
||||
| onEsc | `() => void` | 焦点在 dialog 内部时按下 Esc 键的回调 | NEXT_VERSION |
|
||||
| onNegativeClick | `(e: MouseEvent) => boolean \| Promise<boolean> \| any` | 默认行为是关闭确认框。返回 `false` 或者 resolve `false` 或者 `Promise` 被 `reject` 会避免默认行为 | |
|
||||
| onPositiveClick | `(e: MouseEvent) => boolean \| Promise<boolean> \| any` | 默认行为是关闭确认框。返回 `false` 或者 resolve `false` 或者 `Promise` 被 `reject` 会避免默认行为 | |
|
||||
|
||||
|
@ -10,6 +10,7 @@ export const exposedDialogEnvProps = {
|
||||
...dialogProps,
|
||||
blockScroll: { type: Boolean, default: true },
|
||||
closeOnEsc: { type: Boolean, default: true },
|
||||
onEsc: Function as PropType<() => void>,
|
||||
autoFocus: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
Loading…
x
Reference in New Issue
Block a user