美文网首页
小程序右上角分享及页面按钮分享带参数的设置

小程序右上角分享及页面按钮分享带参数的设置

作者: 花影_62b4 | 来源:发表于2020-12-07 14:26 被阅读0次

    wxml

     <view class='shareBtn'>

            <image src="{{imgUrl}}weixin.png"></image>

            <text>转发微信分享</text>

            <button open-type='share'></button>

          </view>

    wxss

    .shareBtn{

      display: flex;

      flex-direction: column;

      align-items: center;

      font-size: 14px;

      position: relative;

    }

    .shareBtn image{

      width: 45px;

      height: 45px;

      margin-bottom:10px;

    }

    .shareBtn button{

      position:absolute ;

      left: 0;

      top: 0;

      width: 100%;

      height: 100%;

      opacity: 0;

      z-index: 99;

    }

    //js  页面右上角和自定义按钮都走这个方法

    onShareAppMessage: res=>{

        console.log(res.from)

        let meetId=11;

        let UId=wx.getStorageSync('UId')

        return {

          title: '会议名称',

          path: `pages/meet/index?meetId=${meetId}&UId=${UId}&type=1` // 分享后打开的页面

        }

      }

    })

    相关文章

      网友评论

          本文标题:小程序右上角分享及页面按钮分享带参数的设置

          本文链接:https://www.haomeiwen.com/subject/bbxtgktx.html