feat(dialog): add close slot (#5417)

This commit is contained in:
jahnli 2023-12-03 18:16:53 +08:00 committed by GitHub
parent 0f79c83fa3
commit da1a0f38d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 1 deletions

View File

@ -27,6 +27,7 @@
- `n-upload` adds `file-list-class` and `trigger-class` props.
- `n-dynamic-input` adds `input-class` and `tag-class` props.
- `n-dynamic-input` adds `item-class` prop.
- `n-dialog` adds `close` slot.
## 2.35.0

View File

@ -27,6 +27,7 @@
- `n-upload` 新增 `file-list-class``trigger-class` 属性
- `n-dynamic-input` 新增 `input-class``tag-class` 属性
- `n-dynamic-input` 新增 `item-class` 属性
- `n-dialog` 新增 `close` 插槽
## 2.35.0

View File

@ -160,3 +160,4 @@ All the properties can be modified dynamically.
| default | `()` | Dialog content. |
| header | `()` | `Header` content. |
| icon | `()` | `Icon` content. |
| close | `()` | `Close` content. |

View File

@ -161,3 +161,4 @@ focus-debug.vue
| default | `()` | 对话框内容 |
| header | `()` | `header` 内容 |
| icon | `()` | `icon` 内容 |
| close | `()` | `close` 内容 |

View File

@ -246,7 +246,14 @@ export const NDialog = defineComponent({
style={cssVars as CSSProperties}
role="dialog"
>
{closable ? (
{this.$slots.close ? (
<div
class={`${mergedClsPrefix}-dialog__close`}
clsPrefix={mergedClsPrefix}
>
{this.$slots.close?.()}
</div>
) : closable ? (
<NBaseClose
clsPrefix={mergedClsPrefix}
class={`${mergedClsPrefix}-dialog__close`}