1.找到上傳按鈕,綁定事件函數


2.選擇圖片,進入小程序開發手冊,搜索選擇圖片接口,并復制demo


```
https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
```
3.完善上傳圖片函數
```
uploadImg: function (event) {
//1.選擇圖片
wx.chooseImage({
count: 9,//選擇圖片個數
sizeType: \['original', 'compressed'\],
sourceType: \['album', 'camera'\],
success(res) {
// tempFilePath可以作為img標簽的src屬性顯示圖片
const tempFilePaths = res.tempFilePaths;
console.log(tempFilePaths);
}
})
},
```
可以看到上傳圖片后已經可以獲取圖片信息了
