标签:lis gif image dex 参数 indexof tin upload form
1.html
<el-upload class="filesUpload" :action="uploadActionUrl" :on-change="operateImage" :auto-upload="false" :show-file-list="false" :limit="1" > <el-button size="small" type="primary">点击上传</el-button>
2.js
// 上传员工图片 operateImage(file, fileList) { const fileType = file.name.substring(file.name.lastIndexOf(‘.‘) + 1) const types = [‘jpeg‘, ‘gif‘, ‘bmp‘, ‘png‘, ‘jpg‘] const isImage = types.includes(fileType) if (!isImage) { this.$message.error(‘上传图片只能是 JPG、GIF、BMP、PNG 格式!‘) return } else { const fd = new FormData() fd.append(‘projectId‘, getProjectId()) // 参数 fd.append(‘image‘, file.raw) // 图片/文件地址 uploadImage(fd).then(res => { this.imgUser = res[0] }) } },
标签:lis gif image dex 参数 indexof tin upload form
原文地址:https://www.cnblogs.com/wjsy/p/12923979.html