代码拉取完成,页面将自动刷新
class Toast {
static _toast = []
static timer = null
static show(message, duration) {
this._toast.push({
msg: message,
dur: duration ? duration : 2000
})
this.#check()
}
static #check() {
if (this._toast.length == 0) return;
if (this.timer == null) {
const t = this._toast.shift()
let d = document.createElement('div')
d.innerHTML = `<p style="border-radius: 30px;padding: 8px 16px;background-color: #dd000080;color: white; pointer-events: auto;">${t.msg}</p>`
d.style = 'position: fixed;margin: auto;font-size: 16px;left: 0;right: 0;bottom: 40px;z-index: 100;align-items: center;justify-content: center;display: none;pointer-events: none'
document.body.appendChild(d)
$(d).fadeIn(300)
this.timer = setTimeout(() => {
$(d).fadeOut(300, () => {
document.body.removeChild(d)
this.timer = null
this.#check()
})
}, t.dur + 300)
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。