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,
        }
    },
 
 
}
相关推荐
破无差1 天前
《赛事报名系统小程序》
小程序·html·uniapp
00后程序员张1 天前
详细解析苹果iOS应用上架到App Store的完整步骤与指南
android·ios·小程序·https·uni-app·iphone·webview
海绵宝宝不喜欢侬1 天前
uniapp-微信小程序分享功能-onShareAppMessage
微信小程序·小程序·uni-app
2501_915106321 天前
Xcode 上传 ipa 全流程详解 App Store 上架流程、uni-app 生成 ipa 文件上传与审核指南
android·macos·ios·小程序·uni-app·iphone·xcode
xkxnq1 天前
Uniapp崩溃监控体系构建:内存泄漏三维定位法(堆栈/资源/线程)
uni-app
Qlittleboy1 天前
uniapp如何使用本身的字体图标
javascript·vue.js·uni-app
写代码的jiang1 天前
打造精简高效的 uni-app 网络请求工具
uni-app
亮子AI1 天前
【小程序】微信小程序隐私协议
微信小程序·小程序
weixin_177297220691 天前
短剧小程序系统开发:打造个性化娱乐新平台
小程序·娱乐·短剧
weixin_lynhgworld1 天前
剧本杀小程序系统开发:开启沉浸式社交娱乐新纪元
小程序·娱乐