我是靠谱客的博主 妩媚学姐,这篇文章主要介绍element ui上传文件传递参数,.net core api接收不到的问题问题描述解决方案:,现在分享给大家,希望可以做个参考。

问题描述

vue element ui上传文件传递额外参数,.net core api接收不到。


解决方案:

.net core api类名上多写了 [ApiController]

前端代码:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<el-dialog       title="文件上传"       :visible.sync="dialogUpload"       width="30%"       :before-close="handleClose">       <el-upload           class="upload-demo"           ref="upload"           action="http://localhost:9527/api/Upload/UploadFile"           :on-preview="handlePreview"           :on-remove="handleRemove"           :before-remove="beforeRemove"           :before-upload="beforeupload"           multiple           :on-success="handleSuccess"           :on-change="handleChange"           :file-list="fileList"           :auto-upload="false"           :data="{'index': rowNo, 'fileType': 1}">           <el-button size="small" type="primary">选择文件</el-button>                     <div slot="tip" class="el-upload__tip">仅限.jpg、.png、.pdf、.doc、.docx、.xls、.xlsx类型文件</div>         </el-upload>  

后端代码:

复制代码
1
2
3
4
5
6
7
namespace Expenses.Controllers { [Authorize] //[ApiController] [Route("api/[controller]")] public class ProjectController : ControllerBase {

最后

以上就是妩媚学姐最近收集整理的关于element ui上传文件传递参数,.net core api接收不到的问题问题描述解决方案:的全部内容,更多相关element内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(91)

评论列表共有 0 条评论

立即
投稿
返回
顶部