feat: 是否在组件Unmounted时取消上传
This commit is contained in:
@@ -5,7 +5,7 @@ import { h, ref } from 'vue';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Alert, Card, Modal } from 'ant-design-vue';
|
||||
import { Alert, Card, Modal, Switch } from 'ant-design-vue';
|
||||
|
||||
import { FileUpload, ImageUpload } from '#/components/upload';
|
||||
|
||||
@@ -27,6 +27,8 @@ function customAccept(accept: string) {
|
||||
.map((str) => str.toUpperCase())
|
||||
.join(',');
|
||||
}
|
||||
|
||||
const showComponent = ref(true);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -127,6 +129,12 @@ function customAccept(accept: string) {
|
||||
accept-format="自定义显示允许的文件类型"
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<Card title="默认在unMounted会取消上传" size="small">
|
||||
<div>将开发者工具调整网络为3G 切换挂载/卸载 可见请求在卸载被取消</div>
|
||||
挂载/卸载组件: <Switch v-model:checked="showComponent" />
|
||||
<FileUpload v-if="showComponent" v-model:value="singleFileId" />
|
||||
</Card>
|
||||
</div>
|
||||
</Page>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user