如下所示:
<el-upload :action="uploadUrl" ref="upload" :multiple="false" :on-change="fileChange" :before-upload="beforeUpload" :on-success="handleAvatarSuccess" :on-preview="file_click" class="upload-demo" list-type="text" accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf,.JPG,.JPEG,.PBG,.GIF,.BMP,.PDF" :file-list="uploadForm.personFileList" :auto-upload="false"> <el-button size="small" type="primary">选择文件</el-button> <div slot="tip" class="el-upload__tip"><i class="el-icon-warning" style="color:red;margin-right:5px"></i>单个文件不超过5MB</div> </el-upload> accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf,.JPG,.JPEG,.PBG,.GIF,.BMP,.PDF" //accept支持上传文件格式
以上这篇element UI upload组件上传附件格式限制方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。