Merge pull request #1251 from universe-st/PR-Branch
修复弹出金币提示时有框外文字闪现的问题。
This commit is contained in:
commit
7adacc642f
|
@ -348,9 +348,6 @@ export class Create {
|
||||||
* @param {string} message 弹出的文字
|
* @param {string} message 弹出的文字
|
||||||
*/
|
*/
|
||||||
toast(message) {
|
toast(message) {
|
||||||
if(!ui.toastStyle){
|
|
||||||
ui.toastStyle = lib.init.css(lib.assetURL+"layout/default/toast.css");
|
|
||||||
}
|
|
||||||
const toastContainer =
|
const toastContainer =
|
||||||
document.querySelector(".toast-container") ||
|
document.querySelector(".toast-container") ||
|
||||||
(() => {
|
(() => {
|
||||||
|
@ -361,15 +358,24 @@ export class Create {
|
||||||
})();
|
})();
|
||||||
const toast = document.createElement("div");
|
const toast = document.createElement("div");
|
||||||
toast.innerHTML = message;
|
toast.innerHTML = message;
|
||||||
|
const toShow = () => {
|
||||||
toast.classList.add("toast");
|
toast.classList.add("toast");
|
||||||
toastContainer.appendChild(toast);
|
toastContainer.appendChild(toast);
|
||||||
ui.toastQueue.push(toast);
|
ui.toastQueue.push(toast);
|
||||||
ui.create.showNextToast();
|
ui.create.showNextToast();
|
||||||
|
};
|
||||||
|
if (!ui.toastStyle) {
|
||||||
|
ui.toastStyle = lib.init.promises
|
||||||
|
.css(lib.assetURL + "layout/default/toast.css")
|
||||||
|
.then(() => toShow());
|
||||||
|
} else {
|
||||||
|
toShow();
|
||||||
|
}
|
||||||
return toast;
|
return toast;
|
||||||
}
|
}
|
||||||
showNextToast() {
|
showNextToast() {
|
||||||
const toast = ui.toastQueue.shift();
|
const toast = ui.toastQueue.shift();
|
||||||
if(!toast)return;
|
if (!toast) return;
|
||||||
toast.style.display = "block";
|
toast.style.display = "block";
|
||||||
toast.addEventListener("animationend", () => {
|
toast.addEventListener("animationend", () => {
|
||||||
toast.remove();
|
toast.remove();
|
||||||
|
|
Loading…
Reference in New Issue