|
@@ -97,6 +97,12 @@ export default {
|
|
|
this.newUrl = this.url ? this.url : ''
|
|
|
this.hidden = this.url ? false : true
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ measure(val) {
|
|
|
+ this.width = Number(val.split('*')[0]),
|
|
|
+ this.height = Number(val.split('*')[1])
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 上传之前
|
|
|
async beforeUpload(file) {
|
|
@@ -175,7 +181,7 @@ export default {
|
|
|
let img = new Image()
|
|
|
img.src = reader.result
|
|
|
img.onload = () => {
|
|
|
- if (img.width !== this.width && img.height !== this.height) {
|
|
|
+ if (img.width !== this.width || img.height !== this.height) {
|
|
|
this.$message.error(`请上传${this.measure}尺寸的图片`)
|
|
|
resolve(false)
|
|
|
} else {
|