当前位置:网站首页>微信小程序分享页面,分享到朋友圈
微信小程序分享页面,分享到朋友圈
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>
效果



边栏推荐
- 在 RedisTemplate 中使用 scan
- C# 语音端点检测(VAD)实现过程分析
- 802.11--802.11n protocol phy
- 闭关修炼(二十一)Servlet生命周期、service方法源码分析、线程安全问题
- The return values of hostname -f and uname -n may be different
- 工厂模式和策略模式的区别
- Verilog size and +: Using
- Is it safe for the top ten securities companies to open accounts? Is it reliable?
- Calculus Learning
- 二手交易平台碳减排,有了评估标准
猜你喜欢
随机推荐
P6776-[NOI2020]超现实树
闭关修炼(二十四)浅入了解跨域问题
背包九讲——全篇详细理解与代码实现
Pointnet/pointnet++ training and testing
微信小程序自定义多项选择器
Calculus Learning
The difference and usage of JS for in loop and for of loop
Verilog reduction operator
单例模式的理解
laravel 8 实现 订单表按月份水平分表
工厂模式
MYSQL虚拟列
十大券商账号开户安全吗?是靠谱的吗?
微信小程序最新canvas2d手写签名
打印服务IP设置方案
MT yolov6 training and testing
uniapp引入组件不生效解决方法
MYSQL行转列例子
通过ELO机制衡量各类对弈活动水平
July 2022 (advanced soft test) information system project manager certification enrollment Brochure








![[untitled]](/img/6e/5dd5dcff89a74f7d367c9186a77268.png)
