当前位置:网站首页>微信小程序分享页面,分享到朋友圈
微信小程序分享页面,分享到朋友圈
2022-06-29 08:26:00 【swag_特约男演员】
可以前往微信开发文档查看
这个微信已经封装好了

看代码

<template>
<view>my</view>
<!-- 进入提示 -->
<view
class="sharetip"
wx:if="{
{shareTipShow}}"
style="height: {
{ !bottomNum ? mainHeight-30 : mainHeight}}px"
>
<view class="tip_content">点击右上角菜单,可以分享给好友帮忙填写嗷!</view>
<view class="tip_buttom" catchtap="closeShareTip">我知道了</view>
</view>
</template>
<script>
import {
createPage } from '@mpxjs/core'
import store from '../store'
const app = getApp()
createPage({
data: {
mainHeight: app.globalData.mainHeight - 51,
shareTipShow: true
},
computed: {
bottomNum() {
return store.state.bottomNum
}
},
onLoad(options) {
// 从参数判断从哪里来,直接返回分享页
if (options.from === 'timeline' || options.from === 'share') {
// 这个可以直接关闭所有页面打开任意的一个页面
// wx.reLaunch({
// url: '/pages/my'
// })
// 由于这个是tab页,处理tabActive问题
store.commit('CHANGE_TABER', 'my')
}
},
methods: {
// 转发给朋友
onShareAppMessage(res) {
console.log(res)
return {
title: '测试转发',
path: '/pages/my?from=share' // 配置分享的页面路径,你也可以写其他的,可以写首页啊
}
},
// 朋友圈
onShareTimeline(res) {
return {
title: '测试转发到朋友圈',
query: 'test=测试&from=timeline' // 需要携带的参数, 无法自定义路径,只能是当前的分享页
}
},
closeShareTip() {
this.setData({
shareTipShow: false
})
}
}
})
</script>
<style lang="stylus" scoped>
.sharetip
position fixed
top 0
left 0
width 100%
background rgba(0, 0, 0, 0.6)
.tip_content
background #fff
border-radius 40px
width 80%
padding 6px 12px 6px 12px
position absolute
top 30%
right 10%
.tip_buttom
position absolute
top 50%
left 50%
transform translateX(-50%)
background #fff
border-radius 40px
padding 6px 12px 6px 12px
</style>
效果



边栏推荐
猜你喜欢

io流的总结

Unity C # e-learning (12) -- protobuf generation protocol

New paid Tarot calculation source code (with building tutorial)

2022春夏系列 KOREANO ESSENTIAL重塑时装生命力

2022第六季完美童模 海口赛区 选拔赛圆满落幕

Calculus Learning

Mysql使用union all统计多张表组合总数,并分别统计各表数量

2022年7月系统集成项目管理工程师认证招生简章

Batch processing of experimental contact angle data matlab analysis
开发小技巧-图片资源管理
随机推荐
P6776-[noi2020] surreal tree
Some behaviors of Apple developers that are prone to investigation
(pytorch进阶之路三)encoder self attention mask
打印服务IP设置方案
General multiplier design, verilog code
uni-app获取当前页面路由url
通过ELO机制衡量各类对弈活动水平
Uber前安全主管面临欺诈指控 曾隐瞒数据泄露事件
Mqtt second session -- emqx high availability cluster implementation
闭关修炼(二十)如何做好单元测试
verilog 归约操作符
工厂模式
51 MCU interrupt and timer counter, based on Puzhong technology hc6800-esv2.0
2022 Season 6 perfect children's model Haikou competition area trial successfully concluded
开发小技巧-图片资源管理
Typescript variable declaration - type assertion
H5软键盘问题
记微信小程序setData动态修改字段名
Uniapp wechat applet reports an error typeerror: cannot read property 'call' of undefined
首次触电,原来你是这样的龙蜥社区 | 龙蜥开发者说第8期