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



边栏推荐
- 背包九讲——全篇详细理解与代码实现
- 宏,函数和内联函数
- Official reply on issues related to the change of children's names after parents' divorce
- 2022年7月(软考高级)信息系统项目管理师认证招生简章
- 查找字符串中重复次数最多的元素
- Tutorial on building open source Internet of things platform
- Mysql使用union all统计多张表组合总数,并分别统计各表数量
- Verilog expression
- Is it safe for the top ten securities companies to open accounts? Is it reliable?
- Activemq消息组件发布订阅ReDelivery消息重新投递
猜你喜欢

Product manager certification enrollment brochure (NPDP) in July 2022

Batch processing of experimental contact angle data matlab analysis

Compare homekit, MI family, and zhiting family cloud edition for what scene based experiences

随心玩玩(三)Mirai框架QQ机器人

The @dynamicmemberlookup and callasfunction features in swift implement the object transparent proxy function

ActiveMQ message component publish subscribe redelivery message redelivery

MQTT第二话 -- emqx高可用集群实现

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

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

批量处理实验接触角数据-MATLAB分析
随机推荐
Cdga | what is the core of digital transformation in the transportation industry?
操作系统产品密钥查看方法
Let you know today that the passing rate of the PMP Exam is 97%, is it believable
(pytorch进阶之路三)encoder self attention mask
Mqtt second session -- emqx high availability cluster implementation
MySQL virtual column
La finale de la zone de compétition Hefei de la sixième saison 2022 a été couronnée de succès.
802.11--802.11n protocol phy
Wallpaper applet source code double ended wechat Tiktok applet
Verilog size and +: Using
背包九讲——全篇详细理解与代码实现
闭关修炼(二十四)浅入了解跨域问题
搭建开源物联网平台教程
记一些笔试题
工厂模式
ActiveMQ message component publish subscribe redelivery message redelivery
51 MCU interrupt and timer counter, based on Puzhong technology hc6800-esv2.0
调试H5页面-weinre及spy-debugger真机调试
2022第六季完美童模 清远赛区 海选赛圆满落幕
微信小程序最新canvas2d手写签名