引用:https://www.cnblogs.com/panwudi/p/17074172.html
uniapp開發的微信小程序,沒有轉發,分享:
創建一個mixin:common/share.js
export default {onShareAppMessage(res) { //發送給朋友return {}},onShareTimeline(res) {//分享到朋友圈return {}},
}
全局使用,在 main.js 里面 添加全局的 mixin
import share from './common/share.js'
Vue.mixin(share)
const app = new Vue({...App,share
})
自定義分享內容
export default {data() {return {share:{title: '自定義分享標題',imageUrl:'https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg',}}},onShareAppMessage(res) { //發送給朋友return {title: this.share.title,imageUrl: this.share.imageUrl,}},onShareTimeline(res) {//分享到朋友圈return {title: this.share.title,imageUrl: this.share.imageUrl,}},}