feat:添加Toast组件

This commit is contained in:
zyronon
2025-08-12 22:53:08 +08:00
parent b8ab369d54
commit 04e5161554
8 changed files with 389 additions and 37 deletions

33
src/types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,33 @@
declare global {
interface Console {
parse(v: any): void
json(v: any, space: number): void
}
interface Window {
umami: {
track(name: string, data?: any): void
}
}
}
console.json = function (v: any, space = 0) {
const json = JSON.stringify(
v,
(key, value) => {
if (Array.isArray(value)) {
return `__ARRAY__${JSON.stringify(value)}`;
}
return value;
},
space
).replace(/"__ARRAY__(\[.*?\])"/g, (_, arr) => arr);
console.log(json);
return json;
}
console.parse = function (v: any) {
console.log(JSON.parse(v))
}
export {}