Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix0817 #2708

Merged
merged 6 commits into from
Aug 31, 2023
Merged
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
Loading