mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-13 06:34:26 +08:00
完成移动端Suno页面功能
This commit is contained in:
@@ -56,3 +56,24 @@ export function showLoading(message = '正在处理...') {
|
||||
export function closeLoading() {
|
||||
closeToast()
|
||||
}
|
||||
|
||||
// 自定义 Toast 消息系统
|
||||
export function showToastMessage(message, type = 'info', duration = 3000) {
|
||||
const toast = document.createElement('div')
|
||||
toast.className = `fixed top-20 left-1/2 transform -translate-x-1/2 z-50 px-4 py-2 rounded-lg text-white font-medium ${
|
||||
type === 'error' ? 'bg-red-500' : type === 'success' ? 'bg-green-500' : 'bg-blue-500'
|
||||
} animate-fade-in`
|
||||
toast.textContent = message
|
||||
document.body.appendChild(toast)
|
||||
|
||||
if (duration > 0) {
|
||||
setTimeout(() => {
|
||||
toast.classList.add('animate-fade-out')
|
||||
setTimeout(() => {
|
||||
if (document.body.contains(toast)) {
|
||||
document.body.removeChild(toast)
|
||||
}
|
||||
}, 300)
|
||||
}, duration)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user