uniapp小程序分享为灰色

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

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

创建一个mixin:common/share.js

js 复制代码
export default {
    onShareAppMessage(res) { //发送给朋友
        return {}
    },
    onShareTimeline(res) {//分享到朋友圈
        return {}
    },
}

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

js 复制代码
import share from './common/share.js'
Vue.mixin(share) 
const app = new Vue({
    ...App,share
})

自定义分享内容

js 复制代码
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,
        }
    },
 
 
}
相关推荐
qq_12498707531 天前
基于微信小程序的电子元器件商城(源码+论文+部署+安装)
java·spring boot·spring·微信小程序·小程序·毕业设计
weixin_lynhgworld1 天前
科技赋能医疗,陪诊小程序开启就医新体验
科技·小程序
2501_916007472 天前
iOS 证书如何创建,从能生成到能长期使用
android·macos·ios·小程序·uni-app·cocoa·iphone
jqpwxt2 天前
启点创新游乐场多商户分账管理系统:驱动文旅商业生态革新的数字化引擎
大数据·人工智能·小程序
00后程序员张2 天前
AppStoreInfo.plist 在苹果上架流程中的生成方式和作用
android·小程序·https·uni-app·iphone·webview
计算机毕设指导62 天前
基于微信小程序+django连锁火锅智慧餐饮管理系统【源码文末联系】
java·后端·python·mysql·微信小程序·小程序·django
风月歌2 天前
php医院预约挂号系统小程序源代码(源码+文档+数据库)
数据库·微信小程序·小程序·毕业设计·php·源码
qq_12498707532 天前
基于微信小程序的校园资讯共享平台的设计与实现(源码+论文+部署+安装)
spring boot·后端·微信小程序·小程序·毕业设计
2501_915106322 天前
iOS App 测试方法,通过 Xcode、Instruments、Safari Inspector、克魔(KeyMob)等工具
android·ios·小程序·uni-app·iphone·xcode·safari
游戏开发爱好者82 天前
对 iOS IPA 文件进行深度混淆的一种实现路径
android·ios·小程序·https·uni-app·iphone·webview