签入版本
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|:----|:----|:----|
|
||||
| `UPLOAD_ALLOWED_EXTS` | `.jpg,.jpeg,.png,.gif,...,.zip` | 允许上传的文件扩展名(逗号分隔,带点号) |
|
||||
| `UPLOAD_MAX_SIZE_MB` | `10` | 上传文件大小上限(MB) |
|
||||
| `TORNADO_FILE_URL` | `http://file.tornado.elevue2` | 文件访问域名 |
|
||||
| `TORNADO_FILE_URL` | `http://file.tornado.naivevue` | 文件访问域名 |
|
||||
| `TORNADO_UPLOAD_DIR` | `uploads` | 上传文件存储目录 |
|
||||
|
||||
## 上传接口
|
||||
@@ -173,14 +173,14 @@ Service 层的 `BaseService._enrich_file_urls()` 会自动为文件字段补此
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<el-upload
|
||||
<n-upload
|
||||
:action="uploadUrl"
|
||||
:headers="headers"
|
||||
:on-success="handleSuccess"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<el-button type="primary">上传文件</el-button>
|
||||
</el-upload>
|
||||
<n-button type="primary">上传文件</n-button>
|
||||
</n-upload>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -196,7 +196,7 @@ const headers = {
|
||||
function beforeUpload(file) {
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
if (!isLt10M) {
|
||||
ElMessage.error('文件大小不能超过 10MB');
|
||||
window.$message.error('文件大小不能超过 10MB');
|
||||
}
|
||||
return isLt10M;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user