youzan / vant

A lightweight, customizable Vue UI library for mobile web apps.

Home Page:https://vant-ui.github.io/vant/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uploader图片预览报错 Cannot read property 'target' of undefined

chanStudent opened this issue · comments

重现链接

https://codesandbox.io/embed/vant-3-issue-template-forked-13xsvh?fontsize=14&hidenavigation=1&theme=dark

Vant 版本

4.0.6

描述一下你遇到的问题。

image

重现步骤

图片上传,第二次点击预览报错

设备/浏览器

No response

你重现链接的版本描述的不对,我用4.0.6没有报错,你这问题可能是这个原因#11395

image

4.0.4作者貌似修复了,可以试试

我项目是4.0.6的
image
请看我上传的视频
https://hlcg.fjoss.xstore.ctyun.cn/Video_00038.wmv

commented

我这试了 微信、Chrome、Safari、小程序web-view都正常....

最好能提供个最小复现仓库。

猜测可能是 Image 组件中延迟加载,在 onLazyLoaded 和 onMounted/nextTick函数中 onLoad() 调用没有传 event参数,导致 ImagePreview组件下面代码:

const onLoad = (event) => {
  const {
	naturalWidth,
	naturalHeight
  } = event.target;
  state.imageRatio = naturalHeight / naturalWidth;
};

中 的 event是 undefined。

@SplendidDream 你说的这个问题已经修复过咯

由于未复现,这个 issue 先 close 了。

如果有复现链接的话再 re-open。