fix(drawer): on-mask-click may be called multiple times, closes #5476

This commit is contained in:
zhanglecong 2023-12-20 19:29:52 +08:00
parent 8e2c78f4f5
commit b166591cff
3 changed files with 12 additions and 3 deletions

View File

@ -14,7 +14,8 @@
- Fix `n-upload-trigger` in directory drag mode with a lot of files, some of the files are not read.
- Fix `n-dynamic-tags`'s abnormal behavior when using keyboard to trigger add button, closes [#5077](https://github.com/tusen-ai/naive-ui/issues/5077).
- Fix `n-tree` leaf node line color.
- Fix `n-data-table` Summary column `colSpan` Unfilled problem
- Fix `n-data-table` throws error if summary config has empty column.
- Fix `n-drawer`'s `on-mask-click` may be called multiple times.
### Features

View File

@ -14,7 +14,8 @@
- 修复 `n-upload-trigger` 在拖拽文件夹场景下当文件夹内文件较多时,部分文件不会被正确读取的问题
- 修复 `n-dynamic-tags` 使用键盘触发新增时行为异常,关闭 [#5077](https://github.com/tusen-ai/naive-ui/issues/5077)
- 修复 `n-tree` 叶子节点连接线颜色
- 修复 `n-data-table` 总结栏 `colSpan` 未填满的问题
- 修复 `n-data-table` 总结栏有未设定的列时,会抛出 error
- 修复 `n-drawer``on-mask-click` 属性可能被触发多次
### Features

View File

@ -224,6 +224,12 @@ export default defineComponent({
if (onMaskClick) onMaskClick(e)
}
function handleOutsideClick (): void {
if (props.maskClosable) {
doUpdateShow(false)
}
}
const isComposingRef = useIsComposing()
function handleEsc (e: KeyboardEvent): void {
@ -308,6 +314,7 @@ export default defineComponent({
mergedClsPrefix: mergedClsPrefixRef,
namespace: namespaceRef,
mergedBodyStyle: mergedBodyStyleRef,
handleOutsideClick,
handleMaskClick,
handleEsc,
mergedTheme: themeRef,
@ -374,7 +381,7 @@ export default defineComponent({
minWidth={this.minWidth}
showMask={this.showMask}
onEsc={this.handleEsc}
onClickoutside={this.handleMaskClick}
onClickoutside={this.handleOutsideClick}
>
{this.$slots}
</NDrawerBodyWrapper>