wx.chooseImage({
count: num,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
//临时图片文件
let tempImg = res.tempFilePaths[0];
let filetype = tempImg.substring(tempImg.lastIndexOf(".")+1);
if(!("jpg" == filetype || "png" == filetype || "jpeg" == filetype || "gif" == filetype)){
wx.showModal({
title: '格式错误',
content: '合法格式为(png,jpg,jpeg,gif)',
showCancel:false
})
}else{
//合法
that.handleUploadSuccContent(e, mes, res)
}
}
})
微信小程序-过滤不合法图片格式
猜你喜欢
转载自blog.csdn.net/qq_38188047/article/details/103250801
今日推荐
周排行