ElementUI+Vue+SpringBoot上传图片
前端界面,这里随便选了一个改了一下
<el-form-item label="用户头像" prop="userHeaderPicture" style="width:400px;margin-left:550px;">
<el-upload
class="upload-demo"
//后台上传图片接口的URL
action="http://localhost/api/user/upload"
//对应后台的名字
name="userHeaderPicture"
v-model="ruleForm.userHeaderPicture"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleAvatarSuccess"
multiple
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
methods: {
handleRemove(file, fileList) {
console.log(file, fileList);
},
handlePreview(file) {