vant
vant copied to clipboard
fix(ImagePreview): incorrect image slot scaling
fix: 修改以组件调用的方式使用 ImagePreview 时,通过 image 插槽展示图片不支持缩放问题。如果自定义内容不是图片标签,则不支持缩放。
Codecov Report
Attention: 9 lines
in your changes are missing coverage. Please review.
Files | Coverage Δ | |
---|---|---|
...ckages/vant/src/image-preview/ImagePreviewItem.tsx | 80.10% <35.71%> (-3.62%) |
:arrow_down: |
:loudspeaker: Thoughts on this report? Let us know!.
判断 slots 里的内容很难做到准确,因为 slots 里可以插入任意内容,组件是没法确定使用者是不是真的需要图片缩放的。
是否可以把 imageStyle.value
作为 slots 的属性传递给使用者,然后由使用者决定是否要使用该样式呢?
确实是这样的,这个问题得后续再想想吧
已在 https://github.com/youzan/vant/pull/12740 支持