15032 上传头像 没有判空

pet_li_6.6
liujun 2024-04-09 09:22:43 +08:00
parent e37efe2bf8
commit 8cf172365f
1 changed files with 7 additions and 0 deletions

View File

@ -39,6 +39,13 @@ export default {
this.visible = false this.visible = false
}, },
save() { save() {
if (!this.fileList || !this.fileList.length || this.fileList.length === 0) {
this.$message({
type: 'error',
message: '请上传图片!'
})
return
}
this.loading = true this.loading = true
const formData = new FormData() const formData = new FormData()
formData.append('PHOTO', this.fileList[0].raw) formData.append('PHOTO', this.fileList[0].raw)