小程序全局分享配置
App({onLaunch: function(options) {ShareAppMessage()},onShareAppMessage() {// 监听路由变化wx.onAppRoute((res) => {const page = getCurrentPage()if (page) {// 这里和下面 onShareAppMessage, onShareTimeLine 二选一wx.showShareMenu({withShareTicket: true,menus: ['shareAppMessage', 'shareTimeline'],})// ! 模拟器可能不生效,在真机查看ShareAppMessage = () => {{return {title: 'xxxxx!',path: `pages/index/index`,imageUrl: '.png',}}}ShareTimeline = () => {return {title: 'xxxxx!',query: `a=1&b=2`,}}}})},
})
// 方法二,此方法验证可行 date:2022-5-20// app.js
!(function () {var PageOld = PagePage = function (options) {options = Object.assign({getIdCustomer() {return getApp().globalData.idCustomer},onShareAppMessage() {const params = encodeURIComponent(`type=1&val=${IdCustomer()}`){return {title: '惺惺惜惺惺!',path: `/${ute}?qp=${params}`,imageUrl: config.imagePrexDoamin + '/share.png',}}},onShareTimeline() {const params = encodeURIComponent(`type=3&val=${IdCustomer()}`)return {title: '嘻嘻嘻嘻!',query: `qp=${params}`,}},},options)PageOld(options)}
})()
本文发布于:2024-02-05 03:45:59,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170723302362782.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |