viewerjs
viewerjs copied to clipboard
图片行内属性宽高均为 0
Describe the bug
偶现异常,图片不显示,请求是成功了的,去掉这2 个行内属性能看到图片,就是尺寸位置可能不太对劲。
To Reproduce
不能稳定复现
Expected behavior
如果宽高计算有问题,能让浏览器默认计算吗,就给个默认宽度或者高度,然后浏览器默认等比计算就行
Screenshots 见上图
Desktop (please complete the following information):
- OS: macos
- Browser chrome dev
- Version 105.0.5137.4
Additional context
不确定是不是 vieweerjs 的问题,我用的是 v-viewer,我先给那边提一下
https://github.com/mirari/v-viewer/issues/244
还是得在这边提一下。。
而且发现,如果出现了这种情况,换图片(即使重新请求)好像也是没有用的,要刷新页面才行,估计是某段初始化的代码有点问题
这种情况应该是 image 元素触发了 load
事件,但是 image.naturalWidth/Height
却都是 0
。检查一下原图片看看。
这种情况应该是 image 元素触发了
load
事件,但是image.naturalWidth/Height
却都是0
。检查一下原图片看看。
请问怎么检查呢,图片本身肯定没问题,因为去掉这 2 个行内属性能显示出来
如果无法复现,也就无法修复。估计只是该浏览器版本不稳定导致的问题。
@jeff-wangzhen I ran into this issue as well, it might be caused by loading="lazy" on the source image check for the solution #403
@jeff-wangzhen I ran into this issue as well, it might be caused by loading="lazy" on the source image check for the solution #403
@Frankisgek Thanks