wx小程序功能总结

注:1、 微信默认的宽度为750rpx , 不会变化。

  2、bindtap 绑定触摸事件,可冒泡

    catchtap 绑定触摸事件,不可冒泡

1、唤出系统菜单

2、上传图片

showSelection(sizeType,count){
    let _this = this;
    wx.showActionSheet({
      itemList: ['拍照片', '我的相册'],
      success(e) {
        switch (e.tapIndex) {
          case 0: {
            wx.chooseImage({
              count,
              sizeType: [sizeType],
              sourceType: ['camera'],
              success: function (res) {
                let imgList = _this.data.imgList;
                res.tempFilePaths.forEach((it) => {
                  imgList.push(it)
                })
                _this.setData({ imgList })
               },
            })
          }
            break;
          case 1: {
            wx.chooseImage({
              count,
              sizeType: [sizeType],
              success: function (res) {
                let imgList = _this.data.imgList;
                res.tempFilePaths.forEach((it)=>{
                  imgList.push(it)
                })
                _this.setData({imgList})
              },
            })
          }
            break;
        }
        console.log('--suc=>', e)
      },
      fail(e) {
        console.log('--fal=>', e)
      }
    })
  },
原文地址:https://www.cnblogs.com/Mvloveyouforever/p/8652559.html