فهرست منبع

Update index.tsx

lex 2 سال پیش
والد
کامیت
f9c63bb08a
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 11 1
      src/components/col-share/index.tsx

+ 11 - 1
src/components/col-share/index.tsx

@@ -26,7 +26,8 @@ export default defineComponent({
     return {
       swiperIndex: 0,
       image: null as any,
-      codeUrl: ''
+      codeUrl: '',
+      shareLoading: false
     }
   },
   async mounted() {
@@ -77,6 +78,11 @@ export default defineComponent({
         })
     },
     async shareShow() {
+      // 判断是否在分享中...
+      if (this.shareLoading) {
+        return
+      }
+      this.shareLoading = true
       const container: any = document.getElementById(
         `share-preview-container${this.swiperIndex}`
       )
@@ -91,6 +97,7 @@ export default defineComponent({
 
           const image = this.image
           if (image) {
+            this.shareLoading = false
             postMessage(
               {
                 api: 'shareAchievements',
@@ -115,6 +122,7 @@ export default defineComponent({
         })
         .catch(() => {
           Toast.clear()
+          this.shareLoading = false
         })
     }
   },
@@ -194,6 +202,8 @@ export default defineComponent({
               <Button
                 type="primary"
                 round
+                loading={this.shareLoading}
+                loadingText="分享中"
                 onClick={() => {
                   this.shareShow()
                 }}