Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map 遍历中的 onclick 事件无法调用 event.stopPropagation #3998

Closed
A0150315 opened this issue Jul 29, 2019 · 2 comments
Closed

map 遍历中的 onclick 事件无法调用 event.stopPropagation #3998

A0150315 opened this issue Jul 29, 2019 · 2 comments

Comments

@A0150315
Copy link
Contributor

问题描述
map 遍历 Text 组件,给Text组件绑定onClick事件,并在事件中调用

event.stopPropagation

控制台则提示

e.stopPropagation is not a function

复现步骤

  1. 新建一个数据

const tab=['A','B','C'];

  1. 通过以下代码遍历渲染;
{
  tab.map(title => (
    <Text
      onClick={event => {
        event.stopPropagation();
      }}
    >
      {title}
    </Text>
  ));
}
  1. 此时渲染正常;
  2. 点击Text组件;
  3. 控制台报错:

e.stopPropagation is not a function

期望行为

  1. 输出的是

event.stopPropagation is not a function

  1. 不应该报错,且运行正常

报错信息
image

系统信息
Taro CLI 1.2.26 environment info:
System:
OS: Windows 10
Binaries:
Node: 10.15.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD

@taro-bot
Copy link

taro-bot bot commented Jul 29, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@yuche
Copy link
Contributor

yuche commented Jul 29, 2019

close via 5b02527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants