forked from natuka/web.puabadge.com
长按图片保存
This commit is contained in:
1 parent
c5fd42ea51
commit
bec716bb3d
1 file changed
+16
-15
+16
-15
@@ -264,22 +264,23 @@ const createLog = () => {
|
|||||||
const showPreview = ref(false)
|
const showPreview = ref(false)
|
||||||
function save() {
|
function save() {
|
||||||
// 下载图片到本地
|
// 下载图片到本地
|
||||||
const downloadImage = (url: string) => {
|
// const downloadImage = (url: string) => {
|
||||||
const link = document.createElement('a')
|
// const link = document.createElement('a')
|
||||||
link.href = url
|
// link.href = url
|
||||||
link.download = '徽章效果图.png'
|
// link.download = '徽章效果图.png'
|
||||||
document.body.appendChild(link)
|
// document.body.appendChild(link)
|
||||||
link.click()
|
// link.click()
|
||||||
document.body.removeChild(link)
|
// document.body.removeChild(link)
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (imageUrl.value) {
|
// if (imageUrl.value) {
|
||||||
try {
|
// try {
|
||||||
downloadImage(imageUrl.value);
|
// downloadImage(imageUrl.value);
|
||||||
} catch {
|
// } catch {
|
||||||
showPreview.value = true; // 自动下载失败时显示预览
|
// showPreview.value = true; // 自动下载失败时显示预览
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
showPreview.value = true;
|
||||||
}
|
}
|
||||||
const compareList = ref({})
|
const compareList = ref({})
|
||||||
const extend_value = ref(0)
|
const extend_value = ref(0)
|
||||||
|
|||||||
Reference in new issue
Block a user