未验证 提交 e98664be 编写于 作者: A AsherSun 提交者: GitHub

fix(uploader): 修复小程序端传图后报错问题 (#836)

* fix(uploader): Upload quantity limit

* fix(uploader): 修复小程序端传图后报错问题
Co-authored-by: N无始 <wushi@yinge.tech>
上级 cddf23b3
......@@ -23,7 +23,7 @@
<img
class="nut-uploader__preview-img__c"
@click="fileItemClick(item)"
v-if="item.type.includes('image') && item.url"
v-if="item.type?.includes('image') && item.url"
:src="item.url"
/>
<view v-else class="nut-uploader__preview-img__file">
......@@ -233,12 +233,17 @@ export default create({
};
const readFile = (files: Taro.chooseImage.ImageFile[]) => {
const imgReg = /\.(png|jpeg|jpg|webp|gif)$/gi;
files.forEach((file: Taro.chooseImage.ImageFile, index: number) => {
let fileType = file.type;
const fileItem = reactive(new FileItem());
if (!fileType && imgReg.test(file.path)) {
fileType = 'image';
}
fileItem.path = file.path;
fileItem.name = file.path;
fileItem.status = 'ready';
fileItem.type = file.type;
fileItem.type = fileType;
if (props.isPreview) {
fileItem.url = file.path;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册