This commit is contained in:
2025-04-07 18:04:39 +08:00
parent 0b9f4dc555
commit e3debde7e2
21 changed files with 818 additions and 74 deletions

View File

@@ -23,3 +23,32 @@ export const toPage = (url) => {
export const backPage = () => {
window.history.back();
}
export const copy = (context) => {
try {
navigator.clipboard.writeText(context)
.then(() => {
showToast('已复制');
})
.catch(() => {
showToast('复制失败');
});
} catch (e) {
showToast('复制失败');
}
}
export const download = (urls) => {
const promises = urls.map((url, index) => new Promise((resolve, reject) => {
const iframe = document.createElement('iframe');
iframe.src = url;
iframe.style.display = 'none';
document.body.appendChild(iframe);
resolve(true);
}));
Promise.all(promises).then(res => {
console.log(res);
}).catch(err => {
console.log(err);
});
}