Vanessa 2024-03-21 17:32:39 +08:00
parent c6319c3a0e
commit ec622364af

View file

@ -83,6 +83,7 @@ export const bazaar = {
</div> </div>
<div class="fn__flex-1"> <div class="fn__flex-1">
<div class="config-bazaar__panel" data-type="downloaded" data-init="true"> <div class="config-bazaar__panel" data-type="downloaded" data-init="true">
<div data-type="downloaded-update"></div>
<div class="fn__flex config-bazaar__title"> <div class="fn__flex config-bazaar__title">
<button data-type="myPlugin" class="b3-button">${window.siyuan.languages.plugin}</button> <button data-type="myPlugin" class="b3-button">${window.siyuan.languages.plugin}</button>
<div class="fn__space"></div> <div class="fn__space"></div>
@ -292,6 +293,11 @@ export const bazaar = {
</div> </div>
</div>`; </div>`;
}, },
_getUpdate() {
fetchPost("/api/bazaar/getUpdatedPackage", {frontend: getFrontend()}, (response) => {
this.element.querySelector('[data-type="downloaded-update"]').innerHTML = `<div class="fn__flex"></div>`
})
},
_genMyHTML(bazaarType: TBazaarType, app: App) { _genMyHTML(bazaarType: TBazaarType, app: App) {
const contentElement = bazaar.element.querySelector("#configBazaarDownloaded"); const contentElement = bazaar.element.querySelector("#configBazaarDownloaded");
if (contentElement.getAttribute("data-loading") === "true" || if (contentElement.getAttribute("data-loading") === "true" ||
@ -535,6 +541,7 @@ export const bazaar = {
return; return;
} }
this._genMyHTML("plugins", app); this._genMyHTML("plugins", app);
this._getUpdate();
bazaar.element.firstElementChild.addEventListener("click", (event) => { bazaar.element.firstElementChild.addEventListener("click", (event) => {
let target = event.target as HTMLElement; let target = event.target as HTMLElement;
const dataElement = hasClosestByAttribute(target, "data-obj", null); const dataElement = hasClosestByAttribute(target, "data-obj", null);