if (this.disabled) return;
const {
name = '', maxCount, multiple, maxSize, sizeType, lists, camera, compressed, maxDuration, sourceType
} = this;
let chooseFile = null;
const newMaxCount = maxCount - lists.length;
// 设置为只选择图片的时候使用 chooseImage 来实现
chooseFile = new Promise((resolve, reject) => {
uni.chooseImage({
count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
sourceType: sourceType,
sizeType,
success: resolve,
fail: reject
});
});
this.showToast("测试发起");
chooseFile.then(res => {
debugger
let file = null;
let listOldLength = this.lists.length;
res.tempFiles.map((val, index) => {
// 检查文件后缀是否允许,如果不在this.limitType内,就会返回false
if (!this.checkFileExt(val)) return;
// 如果是非多选,index大于等于1或者超出最大限制数量时,不处理
if (!multiple && index >= 1) return;
if (val.size > maxSize) {
this.$emit('on-oversize', val, this.lists, this.index);
this.showToast('超出允许的文件大小');
} else {
if (maxCount <= lists.length) {
this.$emit('on-exceed', val, this.lists, this.index);
this.showToast('超出最大允许的文件个数');
return;
}
lists.push({
url: val.path,
progress: 0,
error: false,
file: val
});
}
});
// 每次图片选择完,抛出一个事件,并将当前内部选择的图片数组抛出去
this.$emit('on-choose-complete', this.lists, this.index);
if (this.autoUpload) this.uploadFile(listOldLength);
})
.catch(error => {
this.$emit('on-choose-fail', error);
});
在安卓端走到测试发起的位置就无法继续,ios端和电脑都能正常打开
m***@163.com (作者)
还有没有其他办法,现在的问题是有两个页面都用这个方法,但是在加载完主页面后,先点击A页面可以正常打开,再点击B页面就无法正常打开,A页面也无法正常打开
2023-01-05 10:48
m***@163.com (作者)
有什么办法可以测试h5,我不清楚具体点击选择照片后运行发生了什么问题
2023-01-05 11:19
4***@qq.com
回复 m***@163.com: 用vconsole插件打日志
2023-11-30 19:06