Skip to content

Commit

Permalink
fix(upload): accept not work as expected
Browse files Browse the repository at this point in the history
修复basicUpload的accept属性未按预期工作的问题
  • Loading branch information
mynetfan committed Sep 11, 2021
1 parent 7593ef6 commit 656ee4e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- 修复可编辑单元格的内容为空时,不会显示编辑图标的问题
- 修复表尾合计行与表格主体部分的列有时候未能对齐的问题
- **MarkDown** 修复初始 value 属性的值不起作用的问题
- **BasicUpload** 修复`accept`属性不支持`MIME`及点开头的后缀名的问题
- **其它**
- 修复部分封装组件在使用插槽时报错的问题
- 修复`useECharts``theme`参数不起作用的问题
Expand Down
8 changes: 7 additions & 1 deletion src/components/Upload/src/useUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ export function useUploadType({
});
const getStringAccept = computed(() => {
return unref(getAccept)
.map((item) => `.${item}`)
.map((item) => {
if (item.indexOf('/') > 0 || item.startsWith('.')) {
return item;
} else {
return `.${item}`;
}
})
.join(',');
});

Expand Down
1 change: 1 addition & 0 deletions src/views/demo/comp/upload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@change="handleChange"
:api="uploadApi"
class="my-5"
:accept="['image/*']"
/>

<a-alert message="嵌入表单,加入表单校验" />
Expand Down

0 comments on commit 656ee4e

Please sign in to comment.