Skip to content

[Bug Report] van-image-preview使用image插槽自定义图片的时候,缩放操作之后,图片偏移 #13706

Open

Description

@millet0328

重现链接

https://codesandbox.io/p/devbox/vant-4-issue-template-forked-mjlkqw?workspaceId=ws_3nBousSwxzY94hBGZ9pnAX

Vant 版本

4.9.21

描述一下你遇到的问题。

van-image-preview使用image插槽自定义图片的时候,缩放操作之后,图片偏移。
如果不使用image插槽,缩放图片的时候,按照图片的中心点缩放的。
查看源代码,发现当使用image插槽的时候,没有处理imageRef的绑定,导致无法计算图片的尺寸。

重现步骤

  1. PC浏览器需要在手机模式下查看
  2. 点击预览按钮
  3. 双击图片,或者手机上双手缩放图片

设备/浏览器

移动端浏览器、PC端浏览器均可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions