beforeUpload (file) {
const _URL = window.URL || window.webkitURL
const isSize = new Promise((resolve, reject) => {
const img = new Image()
img.onload = function () {
(this.width / this.height >= 2.3 && this.width / this.height <= 2.5) ? resolve() : reject()
}
img.src = _URL.createObjectURL(file)
}).then(
() => {
return file
},
() => {
this.$message({
type: 'error',
message: i18n.t('尺寸比例在2.3~2.5之间'),
})
return Promise.reject()
}
)
return isSize
},
04-23
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)