zoukankan      html  css  js  c++  java
  • 原生小程序 常用api集合

    1.手机选择照片

    var that = this;

    wx.chooseImage({

      count: 9, // 默认9
      sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
      sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
      success: function (res) {
        // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
        that.setData({
          tempFilePaths: res.tempFilePaths
        })
      }
    })
     
    2.预览放大图片
    previewImg: function (e) {
      let current = e.target.dataset.src;
      this.setData({
        imglist: Array(current)
      })
      wx.previewImage({
        current: current,//所有的照片集合 类型为数组
        urls: this.data.imglist //需要预览的图片路径
      })
    },
  • 相关阅读:
    在Window上Vim包的选择
    如何在apache官网下载将将jar包
    hdu1870
    hdu1710(Binary Tree Traversals)
    poj 3252 Round Numbers 【推导·排列组合】
    3905
    Find them, Catch them
    Argus
    Team Queue
    Terrible Sets
  • 原文地址:https://www.cnblogs.com/mcll/p/11677654.html
Copyright © 2011-2022 走看看