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

类函数组件中,对绑定的事件处理函数传值错误 #4523

Closed
ksora94 opened this issue Sep 24, 2019 · 3 comments
Closed

类函数组件中,对绑定的事件处理函数传值错误 #4523

ksora94 opened this issue Sep 24, 2019 · 3 comments

Comments

@ksora94
Copy link

ksora94 commented Sep 24, 2019

问题描述
支付宝小程序中,复用类函数组件时,界面显示正确,但对于绑定的事件处理函数传值不正确。

复现步骤

  1. 点击 apple,控制台输出peach
  2. 点击 peach,控制台输出peach
export default class Index extends Component {

  readonly state = {
    item1: {title: 'apple'},
    item2: {title: 'peach'}
  }

  renderItem(item) {
    return <View style={{marginBottom: '0.6rem'}} onClick={() => console.log(item)}>{item.title}</View>
  }

  render () {
    const {item1, item2} = this.state;

    return (
      <View className='index'>
        {this.renderItem(item1)}
        {this.renderItem(item2)}
      </View>
    )
  }
}

期望行为
点击 apple,控制台输出apple,输出正确

报错信息
无报错,输出错误

系统信息

  • 操作系统: macOS 10.14.6
  • Taro 版本 1.3.19
  • Node.js 版本 10.15.3
  • 报错平台 支付宝小程序(其它小程序平台暂未测试)
@taro-bot
Copy link

taro-bot bot commented Sep 24, 2019

欢迎提交 Issue~

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

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

Good luck and happy coding~

@taro-bot
Copy link

taro-bot bot commented Nov 9, 2019

Hello~

您的问题楼上已经提供了解决方案,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@ksora94
Copy link
Author

ksora94 commented Nov 11, 2019

使用上面的例子,在支付宝小程序中问题依然存在。。

  • 操作系统: macOS 10.15.1
  • Taro 版本 1.3.22
  • Node.js 版本 10.15.3

@taro-bot taro-bot bot removed the to be closed label Dec 3, 2019
@taro-bot taro-bot bot closed this as completed Dec 3, 2019
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

3 participants