微信小程序 设置 全局分享
文章目录
onAppRoute这个是小程序的一个隐藏的方法。自己可以打印看看
在app.js中
onLaunch () {
this.mpShare()
},
mpShare () {
wx.onAppRoute(res => {
const pages = getCurrentPages()
const view = pages[pages.length - 1]
if (view) {
const data = view.data
if (!data.isMpShare) {
data.isMpShare = true
view.onShareAppMessage = () => {
return {
title: '小程序',
path: '/pages/home/home'
}
}
}
}
})
},
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论