WeChat mini-program global sharing

//Rewrite share method

overShare: function() {

let _this = this

//Indirect implementation of global settings to share content

wx.onAppRoute(function(res) {

// get loaded page

let pages = getCurrentPages(),

// Get the object of the current page

view = pages[pages.length - 1],

data;

if (view) {

data = view.data;

if (!data.isOverShare) {

data.isOverShare = true;

console.log('Global sharing parameters:', _this.globalData.userid)

view.onShareAppMessage = function() {

//Rewrite share configuration

return {

title: 'Share Title',

path: "/pages/Common/main?scene=" + _this.globalData.userid,

};

}

}

}

})

},

Guess you like

Origin blog.csdn.net/echozly/article/details/122428762