zoukankan      html  css  js  c++  java
  • 微信小程序实例:分享给一个人还是分享到群的判断代码

    微信小程序的分享功能,在最新版库的ide上已经不能拿到分享回调了,官方api也删除了对应的回调函数,看样子是砍掉了,不过真机测试还是可以的,话不多说,上代码:

      /*
      // 分享功能回调
      onLoad: function (options) {
        wx.showShareMenu({
          //只有拥有 shareTicket 才能拿到群信息,用户每次转发都会生成对应唯一的shareTicket 。
          withShareTicket: true
        });
      },
    
      onShareAppMessage: function () {
        var that = this;
        console.log("onShareAppMessage")
        return {
          title: '穿越换装',
          path: '/pages/avatarUpload/index/index',
          success: function (res) {
            if (res.errMsg == 'shareAppMessage:ok') {
              if (res.hasOwnProperty('shareTickets')) {
                console.log(res.shareTickets[0]);
                //分享到群
                that.data.qunshare = 1;
                that.data.geshare = 1;
              } else {
                // 分享到个人
                that.data.geshare = 1;
              }
              wx.showToast({
                title: '分享成功',
                icon: 'success',
                duration: 500
              });
              console.log("shareAppMessage:ok"+ "qun"+ that.data.qunshare +"geren"+ that.data.geshare)
            }
          },
          fail: function (res) {
            if (res.errMsg == 'shareAppMessage:fail cancel') {
              wx.showToast({
                title: '分享失败',
                icon: 'loading',
                duration: 500
              })
            }
            console.log("shareAppMessage:err")
          }
        }
      },
      */

    真机调试 return中内容无法进去;

    --

  • 相关阅读:
    auto-sklearn案例解析二
    auto-sklearn案例解析二
    auto-sklearn案例解析一
    auto-sklearn案例解析一
    auto-sklearn简介
    auto-sklearn简介
    auto-sklearn手册
    auto-sklearn手册
    观念
    JDBC总结
  • 原文地址:https://www.cnblogs.com/Ph-one/p/11967317.html
Copyright © 2011-2022 走看看