当前位置: 移动技术网 > 移动技术>移动开发>IOS > 微信小程序通用方法

微信小程序通用方法

2020年07月17日  | 移动技术网移动技术  | 我要评论

 * 返回顶部

   */

  backTop: function() {

    this.stickyFlag = false, wx.pageScrollTo({

      scrollTop: 0,

      duration: 500

    });

  },

//跳转

goLink: function(event) {

    let url = event.currentTarget.dataset.link;

    url && wx.navigateTo({ url })

  },

//复制

  copy: function () {

    var that = this;

    wx.setClipboardData({

      data: that.data.goodsList[0].code,

      success() {

        wx.showToast({

          title: '复制成功',

          icon: 'success',

          duration: 1000

        })

      }

    })

  },

/**

   * 拨打电话

   */

  callTelphone: function (e) {

    var that = this;

    var phoneNumber = e.currentTarget.dataset.phone;

    if (phoneNumber) {

      this.isCalling || (this.isCalling = true, wx.makePhoneCall({

        phoneNumber: phoneNumber,

        complete: function () {

          that.isCalling = false;

        }

      }));

    }

  },

/**

   * 搜索栏高度

   */

  getScrollViewHeight: function () {

    var that = this;

    wx.createSelectorQuery().select(".search-bar").boundingClientRect(function (res) {

      res.height && that.setData({

        scrollViewHeight: wx.getSystemInfoSync().windowHeight - res.height

      });

    }).exec();

  },

 

本文地址:https://blog.csdn.net/liugenrong/article/details/107352837

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网