fix: code style

This commit is contained in:
dylanmay
2025-11-06 23:23:25 +08:00
parent 500ce9cf7c
commit 007bb2dd26
21 changed files with 116 additions and 105 deletions

View File

@@ -38,7 +38,7 @@ const onBeforeUpload =
props.type === UploadType.Image ? beforeImageUpload : beforeVoiceUpload;
/** 自定义上传 */
const customRequest: UploadProps['customRequest'] = async (options) => {
const customRequest: UploadProps['customRequest'] = async function (options) {
const { file, onError, onSuccess } = options;
const formData = new FormData();

View File

@@ -42,9 +42,9 @@ const uploadRules = {
title: [{ message: '请输入标题', required: true, trigger: 'blur' } as const],
};
const handleCancel = () => {
function handleCancel() {
emit('update:open', false);
};
}
const fileList = ref<any[]>([]);
@@ -58,17 +58,17 @@ const uploadData: UploadData = reactive({
const uploadFormRef = ref<FormInstance | null>(null);
const uploadVideoRef = ref<any>(null);
const submitVideo = async () => {
async function submitVideo() {
try {
await uploadFormRef.value?.validate();
uploadVideoRef.value?.submit();
} catch {
// Validation failed
}
};
}
/** 自定义上传 */
const customRequest: UploadProps['customRequest'] = async (options) => {
const customRequest: UploadProps['customRequest'] = async function (options) {
const { file, onError, onSuccess } = options;
const formData = new FormData();

View File

@@ -49,9 +49,9 @@ const columns = [
];
// 下载文件
const handleDownload = (url: string) => {
function handleDownload(url: string) {
window.open(url, '_blank');
};
}
</script>
<template>

View File

@@ -41,9 +41,9 @@ const columns = [
},
];
const handleDownload = (url: string) => {
function handleDownload(url: string) {
window.open(url, '_blank');
};
}
</script>
<template>

View File

@@ -17,17 +17,23 @@ interface UploadData {
type: UploadType;
}
const beforeImageUpload: UploadProps['beforeUpload'] = (
const beforeImageUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) => useBeforeUpload(UploadType.Image, 2)(rawFile);
) {
return useBeforeUpload(UploadType.Image, 2)(rawFile);
};
const beforeVoiceUpload: UploadProps['beforeUpload'] = (
const beforeVoiceUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) => useBeforeUpload(UploadType.Voice, 2)(rawFile);
) {
return useBeforeUpload(UploadType.Voice, 2)(rawFile);
};
const beforeVideoUpload: UploadProps['beforeUpload'] = (
const beforeVideoUpload: UploadProps['beforeUpload'] = function (
rawFile: UploadRawFile,
) => useBeforeUpload(UploadType.Video, 10)(rawFile);
) {
return useBeforeUpload(UploadType.Video, 10)(rawFile);
};
export {
beforeImageUpload,