lrf402788946 před 4 roky
rodič
revize
33b90d1dc7
1 změnil soubory, kde provedl 19 přidání a 20 odebrání
  1. 19 20
      src/layout/common/share.vue

+ 19 - 20
src/layout/common/share.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="share">
-    <van-button type="info" @click="toShare">分享</van-button>
+    <van-button type="info" @click="init">分享</van-button>
     <van-button type="info" @click="toImg">图片</van-button>
     <van-image :src="simg"></van-image>
   </div>
@@ -25,7 +25,7 @@ export default {
     };
   },
   created() {
-    this.init();
+    // this.init();
   },
   methods: {
     ...weixin(['jsAuth']),
@@ -55,6 +55,22 @@ export default {
         });
         this.$wx.ready(() => {
           console.log('in ready');
+          const shareUrl = 'http://broadcast.waityou24.cn/articlemobile';
+          this.$wx.onMenuShareAppMessage({
+            title: this.title,
+            desc: this.desc,
+            // imgUrl: this.img,
+            link: shareUrl,
+            success: res => {
+              console.log(res);
+              console.log(shareUrl);
+              console.log('in function:share success');
+            },
+            error: err => {
+              alert('share is fail');
+              alert(JSON.stringify(err));
+            },
+          });
         });
         this.$wx.error(res => {
           console.log('config 有问题');
@@ -63,24 +79,7 @@ export default {
       }
     },
     async toShare() {
-      const shareUrl = 'http://broadcast.waityou24.cn/articlemobile';
-      this.$wx.ready(() => {
-        this.$wx.onMenuShareAppMessage({
-          title: this.title,
-          desc: this.desc,
-          // imgUrl: this.img,
-          link: shareUrl,
-          success: res => {
-            console.log(res);
-            console.log(shareUrl);
-            console.log('in function:share success');
-          },
-          error: err => {
-            alert('share is fail');
-            alert(JSON.stringify(err));
-          },
-        });
-      });
+      this.$wx.ready(() => {});
       this.$wx.error(res => {
         console.log('share 有问题');
         console.log(res);