Has Wechat sdk changed again?

problem description

  • setting sharing does not take effect in callback by pulling relevant information through API in spa application
  • sharing configuration takes effect when written outside the callback
  • share the configuration to take effect in Wechat developer tool
  • has clearly written it before. I don"t know if it is because Wechat"s version has been changed that sdk has become invalid
  • .

the environmental background of the problems and what methods you have tried

these problems arise when the recently written page uses this requirement to dynamically share copywriting.
other pages that check the same situation that have been previously configured suddenly have no effect.
, however, if you do not take the API data and set it directly outside the callback, it can take effect.
so it is very likely that Wechat modified the sharing sdk, to only set the sharing configuration immediately after loading, rather than waiting for the API callback.

I have also tried to put wx_init outside the API request and put the API request in the wx_init callback. Wx.onMenuShareAppMessage is written in the API request callback, but it still does not take effect. For more information, please see the following code

.

related codes

/ / Please paste the code text below (do not replace the code with pictures)

// 
var wx_init = (cb) => {
    fetch("https://api.domain.com/wechat/signature?url=" + encodeURIComponent(location.href.split("-sharp")[0])).then((res) => {
        // 
        var wx_config = {...}
        
        wx.config(wx_config);
        wx.ready(cb);
        wx.error(function(e) {alert(e)})
    })
}

// 
// 
fetch("https://api.domain.com/userinfo").then((res) => {
    wx_init(() => {
        // 
        var share_config = {...}
        wx.onMenuShareAppMessage(share_config);
        wx.onMenuShareTimeline(share_config);
    })
})


Aug.25,2021
The

problem has been solved, because there is a problem with my sharing configuration share_config.link, link format, so the sharing configuration does not take effect. Please pay more attention to it in the future

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e45c0c-44b50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e45c0c-44b50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?