提交 1ba20cda 编写于 作者: Q qiang

fix: 修复 image 组件使用 transform 样式后,大小计算错误的问题 question/125987

上级 7205b91d
...@@ -142,14 +142,13 @@ export default { ...@@ -142,14 +142,13 @@ export default {
_fixSize () { _fixSize () {
if (this.ratio) { if (this.ratio) {
const $el = this.$el const $el = this.$el
const rect = $el.getBoundingClientRect()
if (this.mode === 'widthFix') { if (this.mode === 'widthFix') {
const width = rect.width const width = $el.offsetWidth
if (width) { if (width) {
$el.style.height = fixNumber(width / this.ratio) + 'px' $el.style.height = fixNumber(width / this.ratio) + 'px'
} }
} else if (this.mode === 'heightFix') { } else if (this.mode === 'heightFix') {
const height = rect.height const height = $el.offsetHeight
if (height) { if (height) {
$el.style.width = fixNumber(height * this.ratio) + 'px' $el.style.width = fixNumber(height * this.ratio) + 'px'
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册