Merge pull request #1251 from universe-st/PR-Branch

修复弹出金币提示时有框外文字闪现的问题。
This commit is contained in:
Spmario233 2024-04-21 16:29:13 +08:00 committed by GitHub
commit 7adacc642f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 8 deletions

View File

@ -348,9 +348,6 @@ export class Create {
* @param {string} message 弹出的文字
*/
toast(message) {
if(!ui.toastStyle){
ui.toastStyle = lib.init.css(lib.assetURL+"layout/default/toast.css");
}
const toastContainer =
document.querySelector(".toast-container") ||
(() => {
@ -361,10 +358,19 @@ export class Create {
})();
const toast = document.createElement("div");
toast.innerHTML = message;
const toShow = () => {
toast.classList.add("toast");
toastContainer.appendChild(toast);
ui.toastQueue.push(toast);
ui.create.showNextToast();
};
if (!ui.toastStyle) {
ui.toastStyle = lib.init.promises
.css(lib.assetURL + "layout/default/toast.css")
.then(() => toShow());
} else {
toShow();
}
return toast;
}
showNextToast() {