Skip to content

Commit

Permalink
fix(Popup): 修复弹出层禁用遮罩层点击无效问题
Browse files Browse the repository at this point in the history
  • Loading branch information
D-xuanmo committed Sep 1, 2024
1 parent d61ae6a commit 2a37b59
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/components/common/overlay.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const visible2 = ref(false)
|overlay-class|`string`|-|背景过渡时间|N|
|overlay-style|`CSSProperties`|-|自定义 CSS|N|
|teleport|`TeleportProps['to']`|`body`|选择要插入的 DOM 节点,同`Teleport`组件,[参考链接](https://staging-cn.vuejs.org/guide/built-ins/teleport.html#basic-usage)|N|
|close-on-click-overlay|`boolean`|`true`|点击遮罩层是否关闭弹出层|N|
|close-on-overlay-click|`boolean`|`true`|点击遮罩层是否关闭弹出层|N|

### Events

Expand Down
3 changes: 2 additions & 1 deletion packages/dl-common/src/overlay/overlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const [name, bem] = createNamespace('overlay')
export default defineComponent({
name,
inheritAttrs: false,
props: OVERLAY_PROPS,
emits: ['update:visible', 'click'],
setup(props, { emit }) {
Expand Down Expand Up @@ -64,7 +65,7 @@ export default defineComponent({
}
function handleClose() {
if (props.closeOnClickOverlay) {
if (props.closeOnOverlayClick) {
setVisible((innerVisible.value = !innerVisible.value))
emit('click')
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dl-common/src/overlay/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const OVERLAY_PROPS = {
type: Object as PropType<CSSProperties>,
default: undefined
},
closeOnClickOverlay: {
closeOnOverlayClick: {
type: Boolean,
default: true
},
Expand Down
2 changes: 2 additions & 0 deletions packages/dl-common/src/popup/popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:overlay-style="overlayStyle"
:lazy-render="lazyRender"
:lock-scroll="lockScroll"
:close-on-overlay-click="closeOnOverlayClick"
@click="handleClose"
/>
<transition
Expand Down Expand Up @@ -63,6 +64,7 @@ const [name, bem] = createNamespace('popup')
export default defineComponent({
name,
components: { DOverlay, CloseOutlined },
inheritAttrs: false,
props: POPUP_PROPS,
emits: ['update:visible', 'open', 'opened', 'close', 'closed', 'click-overlay-icon'],
setup(props, { emit, slots }) {
Expand Down

0 comments on commit 2a37b59

Please sign in to comment.