本文档为个人博客文档系统的备份版本、作者:小游、作者博客:点击访问
直接贴代码:
ChooseImage() {
//上传图片
wx.chooseImage({
count: 4, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
if (this.data.imgList.length != 0) {
let that=this
//上传图片到自己服务器
wx.uploadFile({
url: 'http://127.0.0.1:2333/api/img/upload',
filePath: res.tempFilePaths[0],
name: 'file',
success (