Skip to content

Commit

Permalink
Fix0817 (#2708)
Browse files Browse the repository at this point in the history
* fix: 弹窗组件如果初始默认显示, 按esc关不掉问题修复 (#2608)

* fix: 弹窗组件如果初始默认显示, 按esc关不掉问题修复 (#2608)

* fix: 弹窗组件如果初始默认显示, 按esc关不掉问题修复 (#2608)

* fix: 弹窗组件如果初始默认显示, 按esc关不掉问题修复 (#2608)

* fix: 弹窗组件如果初始默认显示, 按esc关不掉问题修复 (#2608)
  • Loading branch information
Zhanjiachun authored Aug 31, 2023
1 parent f6f05a3 commit 3d74ef4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ export default mixins(ActionMixin, getConfigReceiverMixins<Vue, DialogConfig>('d
this.clearStyleFunc();
}
// 多个dialog同时存在时使用esc关闭异常 (#1209)
this.storeUid(value);
this.$nextTick(() => {
this.storeUid(value);
});
this.addKeyboardEvent(value);
if (this.isModeLess && this.draggable) {
this.$nextTick(() => {
Expand Down Expand Up @@ -238,12 +240,12 @@ export default mixins(ActionMixin, getConfigReceiverMixins<Vue, DialogConfig>('d
destroySelf() {
this.$el.parentNode?.removeChild?.(this.$el);
},

// 多个dialog情况,若有些给了默认值true,出现ESC关闭不了弹窗问题解决
storeUid(flag: boolean) {
if (flag) {
stack.push(this.uid);
} else {
stack.pop();
stack.pop(this.uid);
}
},
addKeyboardEvent(status: boolean) {
Expand Down
6 changes: 4 additions & 2 deletions src/dialog/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ const push = (value: number) => {
data.push(value);
};

const pop = () => {
data.pop();
const pop = (value: number) => {
if (data.length && data.includes(value)) {
data.pop();
}
};

const stack = {
Expand Down

0 comments on commit 3d74ef4

Please sign in to comment.