当前位置:   article > 正文

uniapp小程序分享为灰色_uniapp 发送给朋友 不能用

uniapp 发送给朋友 不能用

引用:https://www.cnblogs.com/panwudi/p/17074172.html

uniapp开发的微信小程序,没有转发,分享:

创建一个mixin:common/share.js

export default {
    onShareAppMessage(res) { //发送给朋友
        return {}
    },
    onShareTimeline(res) {//分享到朋友圈
        return {}
    },
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

全局使用,在 main.js 里面 添加全局的 mixin

import share from './common/share.js'
Vue.mixin(share) 
const app = new Vue({
    ...App,share
})
  • 1
  • 2
  • 3
  • 4
  • 5

自定义分享内容

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,
        }
    },
 
 
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/268137
推荐阅读
相关标签
  

闽ICP备14008679号