The current page of the uni-app WeChat applet cannot be forwarded

1. Create share.js file

export default {
    created() {
        //#ifdef MP-WEIXIN
        wx.showShareMenu({
            withShareTicket: true,
            menus: ['shareAppMessage', 'shareTimeline']
        });
        //#endif
    },
}

2.Introduce share.js file into main.js

import share from './utils/share.js'
// #ifndef VUE3
import Vue from 'vue'
Vue.mixin(share) 
App.mpType = 'app'
const app = new Vue({
    ...App,share
})
app.$mount()
// #endif

Guess you like

Origin blog.csdn.net/qq_43770056/article/details/131856675