微信小程序设置全局分享

代码已上传至github
github代码地址:https://github.com/Miofly/mio.git

 

App.vue

onShow () {
    // #ifdef MP-WEIXIN
    this.share()
    // #endif
    console.log('onShow:应用页面显示')
},
method: {
    share: function () { // 全局分享
        wx.onAppRoute(res => {
            const pages = getCurrentPages()
            const view = pages[pages.length - 1]
            wx.showShareMenu({
                withShareTicket: true
            })
            view.onShareAppMessage = function () {
                return {
                    title: '这是个大宝贝!',
                    path: view.route
                }
            }
        })
    }
}

 


版权声明:本文为weixin_40013817原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。