vant icon indicating copy to clipboard operation
vant copied to clipboard

fix(ImagePreview): incorrect image slot scaling

Open coderXMin opened this issue 1 year ago • 3 comments

fix: 修改以组件调用的方式使用 ImagePreview 时,通过 image 插槽展示图片不支持缩放问题。如果自定义内容不是图片标签,则不支持缩放。

coderXMin avatar Oct 20 '23 03:10 coderXMin

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!.

codecov-commenter avatar Oct 20 '23 03:10 codecov-commenter

判断 slots 里的内容很难做到准确,因为 slots 里可以插入任意内容,组件是没法确定使用者是不是真的需要图片缩放的。

是否可以把 imageStyle.value 作为 slots 的属性传递给使用者,然后由使用者决定是否要使用该样式呢?

chenjiahan avatar Oct 22 '23 00:10 chenjiahan

确实是这样的,这个问题得后续再想想吧

coderXMin avatar Oct 23 '23 01:10 coderXMin

已在 https://github.com/youzan/vant/pull/12740 支持

chenjiahan avatar Mar 31 '24 12:03 chenjiahan