|
@@ -139,8 +139,10 @@ export default {
|
|
|
async beforeUpload(file) {
|
|
|
if (this.width && this.height) {
|
|
|
const data = await this.readerImg(file)
|
|
|
- if (data.width !== this.width || data.height !== this.height) {
|
|
|
- this.$message.error(`请上传${this.width}x${this.height}尺寸的图片`)
|
|
|
+ let _width = data.width % this.width === 0 || this.width % data.width === 0 ? true : false
|
|
|
+ let _height = data.height % this.height === 0 || this.height % data.height === 0 ? true : false
|
|
|
+ if (!_width || !_height) {
|
|
|
+ this.$message.error(`请上传${this.width}x${this.height}尺寸或同比例倍数的图片`)
|
|
|
return Promise.reject(false)
|
|
|
}
|
|
|
}
|