Browse Source

优化下载图片

skyblued 2 years ago
parent
commit
27fa9cafc2
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/views/mine-orchestra/photo-list/detail.tsx

+ 6 - 0
src/views/mine-orchestra/photo-list/detail.tsx

@@ -36,6 +36,7 @@ export default defineComponent({
     const route = useRoute()
     console.log('🚀 ~ route', route)
     const data = reactive({
+      downLoading: false,
       refreshing: false,
       loading: false,
       finished: false,
@@ -89,6 +90,7 @@ export default defineComponent({
       data.imgShow = true
     }
     const saveImg = async () => {
+      if (data.downLoading) return;
       const container: HTMLElement = document.querySelector(
         `[data-src='${images.value[data.startPosition]}'] img`
       )!
@@ -97,6 +99,7 @@ export default defineComponent({
           message: '保存中',
           duration: 0
         })
+        data.downLoading = true
         html2canvas(container, {
           allowTaint: true,
           useCORS: true,
@@ -121,6 +124,9 @@ export default defineComponent({
             showFailToast('保存失败')
             t.close()
           })
+          .finally(() => {
+            data.downLoading = false
+          })
       }
     }