<el-form ref="form" :model="form" :rules="rules" size="small" label-width="90px">
<el-upload
class="avatar-uploader"
action='http://192.168.1.143:8090/consulting-file/file/tempSaveFile'
name="multipartFile"
:show-file-list="false"
v-model="form.file.fileId"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
``` doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.loading = true
/* this.form.roles = [] */
const _this = this
commit(this.form.file.fileId).then(res => {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500,
})
this.loading = false
this.$parent.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
/* this.roleIds.forEach(function(data, index) {
const role = { id: data }
_this.form.roles.push(role)
}) */
/* this.form.accountNumber.password = md5(this.form.accountNumber.password) */
} else {
return false
}
})
},

上传图片完成时 下次上传上次的图片还会显示出来 怎么清空
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
4条回答 默认 最新
- Houmior 2019-01-24 13:42关注
在dosubmit()里写一个imgurl=''就可以了
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报