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 = () => {
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)

Loading…
Cancel
Save