element ui上传文件传递参数,.net core api接收不到的问题
问题描述vue element ui上传文件传递额外参数,.net core api接收不到。解决方案:.net core api类名上多写了[ApiController]前端代码:<el-dialogtitle="文件上传":visible.sync="dialogUpload"width="30%":before-close="handleClose"><el-upload.
·
问题描述
vue element ui上传文件传递额外参数,.net core api接收不到。
解决方案:
.net core api类名上多写了 [ApiController]
前端代码:
<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>
后端代码:
namespace Expenses.Controllers { [Authorize] //[ApiController] [Route("api/[controller]")] public class ProjectController : ControllerBase {
更多推荐
已为社区贡献1条内容
所有评论(0)