mirror of
https://github.com/atdunbg/Nekosonic-Music.git
synced 2026-06-22 00:58:51 +08:00
- Cookie 存储从 temp_dir 迁移至 Tauri app_data_dir,兼容 Linux - 简单统一风格,UI优化 - recentLocal 播放历史持久化到 localStorage - 添加设置界面可以修改简单的设置
23 lines
512 B
TypeScript
23 lines
512 B
TypeScript
import { ref } from 'vue';
|
|
|
|
export interface Toast {
|
|
id: number;
|
|
message: string;
|
|
type: 'success' | 'error' | 'info';
|
|
}
|
|
|
|
const toasts = ref<Toast[]>([]);
|
|
let nextId = 0;
|
|
|
|
export function showToast(message: string, type: 'success' | 'error' | 'info' = 'info', duration = 3000) {
|
|
const id = nextId++;
|
|
toasts.value.push({ id, message, type });
|
|
setTimeout(() => {
|
|
toasts.value = toasts.value.filter(t => t.id !== id);
|
|
}, duration);
|
|
}
|
|
|
|
export function useToast() {
|
|
return { toasts, showToast };
|
|
}
|