如果使用html的input框设为type=file来选择文件,在安卓的微信中打开页面时,会提示暂无可使用应用等错误提示

解决方案

若要选择图片,需将input框的accept属性设为image/*;若要选择文件,需将此属性设为

1
2
3
4
5
6
7
<input
v-show="false"
:ref="el => { if (el) uploadRefs = el }"
type="file"
:accept="acceptFileTypeArr"
@change="handleUploadFunc"
/>
1
2
3
4
5
6
7
8
9
const acceptFileTypeArr: any = computed(() => { // 当前支持上传类型
if (uploadType.value === 'image') {
return 'image/*';
}
if (uploadType.value === 'file') {
return '';
}
return '';
});

祝君无Bug~