2022-02-24 01:58:58 +00:00
|
|
|
|
<docs>
|
|
|
|
|
---
|
|
|
|
|
order: 10
|
|
|
|
|
title:
|
|
|
|
|
zh-CN: 限制数量
|
|
|
|
|
en-US: Max Count
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
|
|
通过 `maxCount` 限制上传数量。当为 `1` 时,始终用最新上传的代替当前。
|
|
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
|
|
Limit files with `maxCount`. Will replace current one when `maxCount` is `1`.
|
|
|
|
|
</docs>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<a-space direction="vertical" style="width: 100%" size="large">
|
|
|
|
|
<a-upload
|
|
|
|
|
v-model:file-list="fileList"
|
|
|
|
|
list-type="picture"
|
|
|
|
|
:max-count="1"
|
|
|
|
|
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
|
|
|
|
>
|
|
|
|
|
<a-button>
|
|
|
|
|
<upload-outlined></upload-outlined>
|
|
|
|
|
Upload (Max: 1)
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-upload>
|
|
|
|
|
<a-upload
|
|
|
|
|
v-model:file-list="fileList2"
|
|
|
|
|
list-type="picture"
|
|
|
|
|
:max-count="3"
|
|
|
|
|
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
|
|
|
|
>
|
|
|
|
|
<a-button>
|
|
|
|
|
<upload-outlined></upload-outlined>
|
|
|
|
|
Upload (Max: 3)
|
|
|
|
|
</a-button>
|
|
|
|
|
</a-upload>
|
|
|
|
|
</a-space>
|
|
|
|
|
</template>
|
2023-04-28 06:08:21 +00:00
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { ref } from 'vue';
|
2022-02-24 01:58:58 +00:00
|
|
|
|
import { UploadOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
import type { UploadProps } from 'ant-design-vue';
|
2023-04-28 06:08:21 +00:00
|
|
|
|
const fileList = ref<UploadProps['fileList']>([]);
|
|
|
|
|
const fileList2 = ref<UploadProps['fileList']>([]);
|
2022-02-24 01:58:58 +00:00
|
|
|
|
</script>
|