zoukankan      html  css  js  c++  java
  • wx小程序 button 属性open-typ 用法 按钮分享

    wx.ml

      <button class="btn" open-type="share" data-mode="teacher" data-type="1">hello world</button>

    wx.js 内wx 定义的分享方法

      /**
       * 用户点击右上角分享
       */
      onShareAppMessage: function (e) {
        console.log(e)
        let that = this;
        let type = that.data.shareToObjType;
        let mode = e.target.dataset.mode;
        let userInfo = that.data.userInfo;
        let teamId = that.data.teamId;
        let teamName = that.data.teamName;
        if (mode == "teacher") {
          return {
            title: userInfo.name + "邀请您加入机构",
            path: "/pages/common/invitejoinclass/index?type=2&schoolName=" + userInfo.schoolName + "&schoolId=" + userInfo.schoolId,
            imageUrl: "/image/share.png"
          }
        } else {
          if (type == 1) {
            //student
            return {
              title: userInfo.name + "邀请您加入班级",
              path: "/pages/common/invitejoinclass/index?type=1&teamId=" + teamId + "&teamName=" + teamName + "&schoolId=" + userInfo.schoolId + "&schoolName=" + userInfo.schoolName,
              imageUrl: "/image/share.png"
            }
          }
        }
      }
    View Code
  • 相关阅读:
    ###第五次作业###
    第四次作业
    第三次作业
    jquery cookie插件
    jquery.form.js(ajax表单提交)
    jquery 中 $.map 用法
    jQuery中的$.grep()使用
    jquery-validation验证插件
    软件工程实践2017第一次作业
    jQuery UI dialog 的使用
  • 原文地址:https://www.cnblogs.com/lvlisn/p/15109545.html
Copyright © 2011-2022 走看看