[issue/455]上传组件传入accept限制上传文件类型无效

pull/474/head
zhangdaiscott 2023-04-11 22:02:51 +08:00
parent ccbdd0cf6d
commit f48e1125d0
2 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,7 @@
<div class="clearfix"> <div class="clearfix">
<a-upload <a-upload
:listType="listType" :listType="listType"
accept="image/*"
:multiple="multiple" :multiple="multiple"
:action="uploadUrl" :action="uploadUrl"
:headers="headers" :headers="headers"

View File

@ -26,7 +26,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, computed, watch, nextTick, createApp } from 'vue'; import { ref, reactive, computed, watch, nextTick, createApp,unref } from 'vue';
import { Icon } from '/@/components/Icon'; import { Icon } from '/@/components/Icon';
import { getToken } from '/@/utils/auth'; import { getToken } from '/@/utils/auth';
import { uploadUrl } from '/@/api/common/api'; import { uploadUrl } from '/@/api/common/api';
@ -82,7 +82,10 @@
const isImageMode = computed(() => props.fileType === UploadTypeEnum.image); const isImageMode = computed(() => props.fileType === UploadTypeEnum.image);
// props attrs // props attrs
const bindProps = computed(() => { const bindProps = computed(() => {
const bind: any = Object.assign({}, props, attrs); //update-begin-author:liusq date:20220411 for: [issue/455]accept
const bind: any = Object.assign({}, props, unref(attrs));
//update-end-author:liusq date:20220411 for: [issue/455]accept
bind.name = 'file'; bind.name = 'file';
bind.listType = isImageMode.value ? 'picture-card' : 'text'; bind.listType = isImageMode.value ? 'picture-card' : 'text';
bind.class = [bind.class, { 'upload-disabled': props.disabled }]; bind.class = [bind.class, { 'upload-disabled': props.disabled }];