
<el-upload
:disabled="uploadDisabled"
action="/ImageServer/YmUpload_image"
list-type="picture-card"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove(e, 'shopLogo')"
:http-request="handleSuccess(e, 'shopLogo')"
:before-upload="beforeImgUpload"
:file-list="shopLogo"
:on-exceed="limitTip"
:limit="1"
accept=".JPG,.png,.GIF"
>
<div style="width:148px;height:148px;position:absolute;" @click="show_uploadDialog(1, 'shopLogo')"></div>
<i class="el-icon-plus"></i>
</el-upload>
let extension = file.name.substring(file.name.lastIndexOf('.')+1)
let size = file.size / 1024 / 1024
let types = ['image/jpeg', 'image/jpg', 'image/png'];
if(extension !== 'xlsx') {
this.$notify.warning({
title: '警告',
message: `只能上传Excel2017(即后缀是.xlsx)的文件`
});
}
if(size > 10) {
this.$notify.warning({
title: '警告',
message: `文件大小不得超过10M`
});
}
const isJPG = types.includes(file.type)
if (!isJPG) {
this.$message.error('上传图片只能是 JPG、JPEG、PNG 格式!');
}
return isJPG;