From ab45f6000560477831f0296e4e14df4313364338 Mon Sep 17 00:00:00 2001 From: YunYouJun Date: Mon, 5 Feb 2024 01:13:01 +0800 Subject: [PATCH] fix: copy img --- components/SpringFestivalCouplets.vue | 14 +- pnpm-lock.yaml | 3132 +++++++++++-------------- 2 files changed, 1395 insertions(+), 1751 deletions(-) diff --git a/components/SpringFestivalCouplets.vue b/components/SpringFestivalCouplets.vue index 07eb75f..a0e7a8f 100644 --- a/components/SpringFestivalCouplets.vue +++ b/components/SpringFestivalCouplets.vue @@ -13,16 +13,17 @@ defineProps<{ const app = useAppStore() +const sfcContainer = ref(null) + /** * Download image */ async function download() { - const container = document.getElementById('spring-festival-container') - if (!container) + if (!sfcContainer.value) return // const url = await screenShotToBase64(container) - const url = await toPng(container, { + const url = await toPng(sfcContainer.value, { includeQueryParams: true, }) @@ -34,12 +35,11 @@ async function download() { * Copy image to clipboard */ async function copyImg() { - const container = document.getElementById('girid-container') - if (!container) + if (!sfcContainer.value) return // const url = await screenShotToBase64(container) - const blob = await toBlob(container, { + const blob = await toBlob(sfcContainer.value, { includeQueryParams: true, }) @@ -60,7 +60,7 @@ async function shareLink() {