The page refresh will trigger updateAppMessageShareData.

problem description

Wechat official account: updateAppMessageShareData and updateTimelineShareData methods are triggered when ios phones enter the page, and

is triggered occasionally when Android phones enter the page.

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

Service number development, consulted the documentation, but did not find a solution

related codes

$(function(){
    var script=document.createElement("script");
    script.type="text/javascript";
    script.src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js";
    document.getElementsByTagName("head")[0].appendChild(script);
    script.onload=function(){
        fetch("/api/we/chat/share","POST",{
            url:location.href.split("-sharp")[0]
        }).then(res => {
            if(res.state == 200){
                console.log(res);
                wx.config({
                    debug: false,
                    appId: res.data.appid,
                    timestamp: res.data.timestamp,
                    nonceStr: res.data.nonceStr, 
                    signature: res.data.signature,
                    jsApiList: ["checkJsApi","onMenuShareTimeline","onMenuShareAppMessage","updateTimelineShareData","updateAppMessageShareData"]
                });
                wx.ready(function () {
                    wx.onMenuShareTimeline({
                        title: "", // 
                        desc: "", // 
                        link: url_+"/xu-gong/html/into.html", 
                        imgUrl: getRootPath()+"xu-gong/img/logo.jpg", // 
                        success: function () {
                            shareEgg()
                        }
                    });
                    wx.onMenuShareAppMessage({
                        title: "", // 
                        desc: "", // 
                        link: url_+"/xu-gong/html/into.html",
                        imgUrl: getRootPath()+"xu-gong/img/logo.jpg", //  
                        success: function () {
                            shareEgg()
                        }
                    });
                    
                });
                // alert(location.href.split("-sharp")[0])
                wx.updateAppMessageShareData({ 
                    title: "", // 
                    desc: "", // 
                    link: url_+"/xu-gong/html/into.html", 
                    imgUrl: getRootPath()+"xu-gong/img/logo.jpg", // 
                    success: function () {
                        // 
                        shareEgg()
                    }
                });
                wx.updateTimelineShareData({ 
                    title: "", // 
                    desc: "", // 
                    link: url_+"/xu-gong/html/into.html", 
                    imgUrl: getRootPath()+"xu-gong/img/logo.jpg", // 
                    success: function () {
                        // 
                        shareEgg()
                    }
                });
            }else{
                layer.msg(res.message,{time:1500});
            }
        })
    }
});

what result do you expect? What is the error message actually seen?

these two events are triggered only when sharing

Apr.28,2022

the success of updateAppMessageShareData and updateTimelineShareData is triggered after it is set up, that is, if the configuration is all right, it triggers
. I don't know what to do after sharing the success in these two methods.


initialize the updateAppMessageShareData in the success of onMenuShareAppMessage.


updateAppMessageShareData and updateTimelineShareData methods must be placed in ready
in addition, try to make sure that users call a series of shared methods before clicking on sharing

wx.ready(function () {   //
    wx.updateAppMessageShareData({ 
        title: '', // 
        desc: '', // 
        link: '', // JS
        imgUrl: '', // 
        success: function () {
          // 
        }
});

follow and encounter the same problem

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-1eb344d-2441.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-1eb344d-2441.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?