Failed to share web page Wechat

encountered a very strange phenomenon, single-page application. The information shared by Wechat is set up on the page. The configuration information is as follows:

 wx.ready(() => {
        wx.onMenuShareTimeline({
          title: this.package.title,
          link: window.location.href,
          imgUrl: this.package.image,
          success: function() {
            console.log("")
          }
        });
        wx.onMenuShareAppMessage({
          title: this.package.title,
          desc: this.package.brief,
          link: window.location.href,
          imgUrl: this.package.image,
          success: function() {
            console.log("")
          }
        });
      })

case 1: enter the page to be shared from other pages and share it out. The configured images and sharing links are not applied, but the return function is called to share successfully.
case 2: go to the page you want to share directly through url, share it, apply the configured images and sharing links, and call the return function that is successful in sharing.

this phenomenon is only found in Android so far.


encapsulate your sharing method. After you have configured the picture and the sharing link, use settimeout to trigger the sharing call, similar to

.
this.page_title = this.currentData[0].data[0].name + '-';
this.page_desc = this.currentData[0].data[0].title;
window.setTimeout(function(){wechat.init(wxjs_config);},100);

I think I didn't get the value. You can print it out and have a look at it

.

clipboard.png

Menu