单文件
-
返回值:字符串/对象json字符串
-
使用方式
<fileUpload v-model="file" />
<fileUpload save-type="object" v-model="file" />
-
组件页面
<template>
<div class="upload-file">
<el-upload
:on-progress="handleProgressUpload"
:action="uploadFileUrl"
:before-upload="beforeFileUpload"
:file-list="fileList"
:auto-upload="true"
:on-error="handleUploadError"
:on-exceed="handleExceed"
:on-success="handleFileSuccess"
:show-file-list="false"
:limit="1"
:data="qnData"
class="upload-file-uploader"
ref="upload"
>
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<!-- 上传提示 -->
<div class="el-upload__tip" slot="tip" v-if="showTip">
请上传
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">