mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix lint
This commit is contained in:
parent
79ca7631e0
commit
0ba9333634
@ -29,9 +29,9 @@
|
||||
},
|
||||
style() {
|
||||
const padding = `${this.gutter / 2}px`;
|
||||
return this.gutter ?
|
||||
{ paddingLeft: padding, paddingRight: padding } :
|
||||
null;
|
||||
return this.gutter
|
||||
? { paddingLeft: padding, paddingRight: padding }
|
||||
: null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -47,30 +47,30 @@ export default {
|
||||
* 根据屏幕自适应显示最长边
|
||||
*/
|
||||
computeImageStyle() {
|
||||
const previewSize = this.$refs.previewContainer.getBoundingClientRect();
|
||||
const img = new Image();
|
||||
const _this = this;
|
||||
// const previewSize = this.$refs.previewContainer.getBoundingClientRect();
|
||||
// const img = new Image();
|
||||
// const _this = this;
|
||||
|
||||
img.onload = function() {
|
||||
const imgRatio = parseFloat(this.width / this.height);
|
||||
const previewRatio = parseFloat(previewSize.width / previewSize.height);
|
||||
// img.onload = function() {
|
||||
// const imgRatio = parseFloat(this.width / this.height);
|
||||
// const previewRatio = parseFloat(previewSize.width / previewSize.height);
|
||||
|
||||
if (previewRatio <= imgRatio) {
|
||||
const top = (previewSize.height - parseInt(previewSize.width / imgRatio, 10)) / 2;
|
||||
_this.imageStyle = {
|
||||
width: '100%',
|
||||
height: 'auto',
|
||||
top: top + 'px'
|
||||
};
|
||||
} else if (previewRatio > imgRatio) {
|
||||
_this.imageStyle = {
|
||||
width: 'auto',
|
||||
height: '100%'
|
||||
};
|
||||
}
|
||||
};
|
||||
// if (previewRatio <= imgRatio) {
|
||||
// const top = (previewSize.height - parseInt(previewSize.width / imgRatio, 10)) / 2;
|
||||
// _this.imageStyle = {
|
||||
// width: '100%',
|
||||
// height: 'auto',
|
||||
// top: top + 'px'
|
||||
// };
|
||||
// } else if (previewRatio > imgRatio) {
|
||||
// _this.imageStyle = {
|
||||
// width: 'auto',
|
||||
// height: '100%'
|
||||
// };
|
||||
// }
|
||||
// };
|
||||
|
||||
img.src = this.image;
|
||||
// img.src = this.image;
|
||||
},
|
||||
|
||||
close() {
|
||||
|
@ -20,9 +20,9 @@
|
||||
style() {
|
||||
const gutter = Number(this.gutter);
|
||||
const margin = `-${gutter / 2}px`;
|
||||
return gutter ?
|
||||
{ marginLeft: margin, marginRight: margin } :
|
||||
{};
|
||||
return gutter
|
||||
? { marginLeft: margin, marginRight: margin }
|
||||
: {};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user