【问题标题】:How to use aframe-react events properly in .map?如何在 .map 中正确使用 aframe-react 事件?
【发布时间】:2018-05-24 10:14:43
【问题描述】:

我正在尝试渲染图像,并且每个图像都应该是可点击的。我试着在下面写一个代码。但是,点击事件会在用户访问组件时触发。你能解释一下为什么会这样吗?

the code that I wrote is here

【问题讨论】:

    标签: aframe aframe-react


    【解决方案1】:

    当我使用回调函数时,它成功了!

    events={{click: () => this.props.addToCart(item.product_id)}}

    【讨论】:

      猜你喜欢
      • 2023-03-25
      • 1970-01-01
      • 1970-01-01
      • 2020-05-08
      • 2017-07-17
      • 2019-05-09
      • 2021-10-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多