|
@ -4,7 +4,8 @@ import {defineComponent} from 'vue' |
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
uploadUrl: '' |
|
|
uploadUrl: '', |
|
|
|
|
|
loading: false |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -27,13 +28,26 @@ export default { |
|
|
this.$message.error(this.$t('upload.tip', { format: '.jar' })) |
|
|
this.$message.error(this.$t('upload.tip', { format: '.jar' })) |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 加载 |
|
|
|
|
|
this.loading = true; |
|
|
}, |
|
|
}, |
|
|
// 上传成功 |
|
|
// 上传成功 |
|
|
uploadSuccessHandle (res, file, fileList) { |
|
|
uploadSuccessHandle (res, file, fileList) { |
|
|
|
|
|
this.loading = false; |
|
|
if (res.code !== 0) { |
|
|
if (res.code !== 0) { |
|
|
return this.$message.error(res.msg) |
|
|
return this.$message.error(res.msg) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
// 上传错误 |
|
|
|
|
|
uploadErrorHandle(err, file, fileList) { |
|
|
|
|
|
this.loading = false; |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
type:'error', |
|
|
|
|
|
message: err |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
@ -44,7 +58,9 @@ export default { |
|
|
:action="uploadUrl" |
|
|
:action="uploadUrl" |
|
|
class="upload-demo" |
|
|
class="upload-demo" |
|
|
drag |
|
|
drag |
|
|
:before-upload="uploadBeforeUploadHandle" :on-success="uploadSuccessHandle" |
|
|
:before-upload="uploadBeforeUploadHandle" |
|
|
|
|
|
:on-success="uploadSuccessHandle" |
|
|
|
|
|
:on-error="uploadErrorHandle" |
|
|
multiple> |
|
|
multiple> |
|
|
<i class="el-icon-upload"></i> |
|
|
<i class="el-icon-upload"></i> |
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> |
|
|