update
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user