|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div id="share">
|
|
|
- <van-button type="info" @click="init">分享</van-button>
|
|
|
+ <van-button type="info" @click="toShare">分享</van-button>
|
|
|
<van-button type="info" @click="toImg">图片</van-button>
|
|
|
<van-image :src="simg"></van-image>
|
|
|
</div>
|
|
@@ -25,6 +25,7 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
+ console.log('in function:');
|
|
|
this.init();
|
|
|
},
|
|
|
methods: {
|
|
@@ -55,22 +56,6 @@ 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 有问题');
|
|
@@ -79,7 +64,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async toShare() {
|
|
|
- this.$wx.ready(() => {});
|
|
|
+ this.$wx.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('share 有问题');
|
|
|
console.log(res);
|