微信小程序获取手机相册里的图片并传到页面上
index.wxml代码// 相册中的照片<button bindtap=‘handleChooseAlbum’>选中图片</button><image arc=“{{imagePath}}”/>
2.index.js代码
Page({data : {imagePath : ‘’},handleChooseAlbum(){//系统API,让用户在相册中选择图片(或者拍照)wx.chooseImage({success : (res) => {//1、取出路径const path = res.tempFilePaths[0]//2、设置imagePaththis.setData({imagePath : path})}})}})