Browse Source

长按图片保存

lzm_web
Linzm 8 months ago
parent
commit
bec716bb3d
  1. 31
      src/views/badge/preview.vue

31
src/views/badge/preview.vue

@ -264,22 +264,23 @@ const createLog = () => { @@ -264,22 +264,23 @@ const createLog = () => {
const showPreview = ref(false)
function save() {
//
const downloadImage = (url: string) => {
const link = document.createElement('a')
link.href = url
link.download = '徽章效果图.png'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
// const downloadImage = (url: string) => {
// const link = document.createElement('a')
// link.href = url
// link.download = '.png'
// document.body.appendChild(link)
// link.click()
// document.body.removeChild(link)
// }
if (imageUrl.value) {
try {
downloadImage(imageUrl.value);
} catch {
showPreview.value = true; //
}
}
// if (imageUrl.value) {
// try {
// downloadImage(imageUrl.value);
// } catch {
// showPreview.value = true; //
// }
// }
showPreview.value = true;
}
const compareList = ref({})
const extend_value = ref(0)

Loading…
Cancel
Save