Skip to content

Commit

Permalink
update dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
obgnail committed Aug 1, 2024
1 parent 18d67be commit 655c76c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion plugin/custom/plugins/pluginUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class pluginUpdaterPlugin extends BaseCustomPlugin {
title = "更新失败";
components = [{ type: "span", label: "发生未知错误,请向开发者反馈" }];
}
setTimeout(() => this.utils.dialog.modal({ title, components, width: "600px" }, callback), 50);
this.utils.dialog.modal({ title, components, width: "600px" }, callback);
}

getProxy = async () => (this.config.proxy || (await new ProxyGetter(this).getProxy()) || "").trim()
Expand Down
17 changes: 9 additions & 8 deletions plugin/global/core/utils/mixin/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,21 @@ class dialog {
this.entities.submit.addEventListener("click", () => this.onButtonClick(this.submitCallback))
}

onButtonClick = async cb => {
onButtonClick = async callback => {
const { components } = this.modalOption || {}; // 先取出来,接下来this.modalOption会被置为空
this.entities.body.querySelectorAll(".form-group[component-id]").forEach(el => {
const id = el.getAttribute("component-id");
const c = this.modalOption.components.find(c => c.id === id);
if (c) {
c.submit = this.getWidgetValue(c.type, el);
const component = components.find(c => c.id === id);
if (component) {
component.submit = this.getWidgetValue(component.type, el);
}
})
this.entities.modal.close();
if (cb) {
await cb(this.modalOption.components);
}
this.set();
this.entities.modal.close();
this.entities.body.innerHTML = "";
if (callback) {
await callback(components);
}
}

checkComponents = components => {
Expand Down

0 comments on commit 655c76c

Please sign in to comment.