提交 c2447664 编写于 作者: Q qiang

fix: 解决 Chrome 浏览器上某些情况下导致 1px 缝隙的问题

上级 e999a4ed
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
@resize="_resize" /> @resize="_resize" />
</uni-image> </uni-image>
</template> </template>
<script> <script>
export default { export default {
name: 'Image', name: 'Image',
props: { props: {
...@@ -122,8 +122,13 @@ export default { ...@@ -122,8 +122,13 @@ export default {
}, },
_fixSize () { _fixSize () {
const elWidth = this._getWidth() const elWidth = this._getWidth()
if (elWidth) { if (elWidth) {
this.$el.style.height = elWidth / this.ratio + 'px' let height = elWidth / this.ratio
// fix: 解决 Chrome 浏览器上某些情况下导致 1px 缝隙的问题
if (typeof navigator && navigator.vendor === 'Google Inc.' && height > 10) {
height = Math.round(height / 2) * 2
}
this.$el.style.height = height + 'px'
this.sizeFixed = true this.sizeFixed = true
} }
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册