跳到主要内容

UppyUpload

使用方式​

<script lang="ts" setup>
const policyName = ref("my-test-policy");
const groupName = ref("my-test-group");
</script>

<template>
<UppyUpload
endpoint="/apis/api.console.halo.run/v1alpha1/attachments/upload"
:meta="{
policyName: policyName,
groupName: groupName,
}"
/>
</template>

Props​

表 1 Props
属性名类型默认值描述——————
restrictionsRestrictionsundefined可选,指定任何限制。——————
metaRecord<string, unknown>undefined可选,要发送的额外元数据。——————
autoProceedbooleanfalse可选,在某些操作后自动继续。——————
allowedMetaFieldsstring[]undefined可选,指定允许的元数据字段。——————
endpointstring无,必填数据发送到的端点 URL。——————
namestringfile可选,用于上传的表单字段的名称。——————
notestringundefined可选,任何备注或描述。——————
method"GET" \"POST" \"PUT" \"HEAD" \"get" \"post" \"put"post可选,用于请求的 HTTP 方法。
disabledbooleanfalse可选,如果为真,则禁用组件。——————
widthstring750px可选,组件的宽度。——————
heightstring550px可选,组件的高度。——————
doneButtonHandler() => voidundefined可选,完成时调用的处理函数。——————

Emits​

表 2 Emits
事件名称参数描述
uploadedresponse: SuccessResponse 类型,表示上传成功的响应。当文件上传成功时触发。
errorfile: 出错的文件。
response: 出错时的响应数据。
当文件上传出错时触发。