< el-form-item label= "upload Picture" >
<!-- <el-form-item label=""> -->
<el-upload
class="avatar-uploader"
:action=""http://tupain/:img_path" "
:show-file-list="false"
:on-success="handleServiceAvatarScucess"
:before-upload="beforeAvatarUpload">
<!-- <img v-if="selectTable.image_path" :src=""https://elm.cangdu.org/img/" + selectTable.image_path" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
</el-upload>
</el-form-item>
The function of tone
handleServiceAvatarScucess(res, file) {
console.log(res);
},
beforeAvatarUpload(file) {
const isRightType = (file.type === "image/jpeg") || (file.type === "image/png");
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isRightType) {
this.$message.error(" JPG !");
}
if (!isLt2M) {
this.$message.error(" 2MB!");
}
return isRightType && isLt2M;
},
: