The uniapp applet realizes the function of forwarding to friends and sharing to Moments
Create a js file, my file path is: common/share.js
export default {
created() {
//#ifdef MP-WEIXIN
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
});
//#endif
},
}
For global use, add a global mixin in main.js
import share from './common/share.js'
Vue.mixin(share)
const app = new Vue({
...App,share
})