This commit is contained in:
Vanessa 2023-05-09 19:17:16 +08:00
parent c7b43df2d8
commit 1e04a4aa07

View file

@ -6,7 +6,7 @@ import {isMobile, isWindow} from "../util/functions";
export class Plugin { export class Plugin {
public i18n: IObject; public i18n: IObject;
public eventBus: EventBus; public eventBus: EventBus;
public data: any = {}; public data: any;
public name: string; public name: string;
constructor(options: { constructor(options: {
@ -52,6 +52,9 @@ export class Plugin {
} }
public loadData(storageName: string) { public loadData(storageName: string) {
if (!this.data) {
this.data = {}
}
if (typeof this.data[storageName] === "undefined") { if (typeof this.data[storageName] === "undefined") {
this.data[storageName] = ""; this.data[storageName] = "";
} }
@ -76,6 +79,7 @@ export class Plugin {
formData.append('file', file); formData.append('file', file);
formData.append('isDir', "false"); formData.append('isDir', "false");
fetchPost("/api/file/putFile", formData, (response) => { fetchPost("/api/file/putFile", formData, (response) => {
this.data[storageName] = data;
resolve(response); resolve(response);
}); });
}); });