-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
RadioGroup 最后一个Radio无法触发onChange事件 #1176
Comments
欢迎提交 Issue~ 如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏 如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。 Good luck and happy coding~ |
能贴一下编译之后的代码吗 |
|
我尝试复现一下这个情况 |
hello,请问还有这个问题吗 |
1.2.0-beta.7 还存在这个问题 |
@xyunsh 还是小程序中对吧? |
CC @Chen-jj |
@Chen-jj 帮忙看一下咯 |
@xyunsh 复现不了。 另外你说 Label 加 for 属性后点不动,极其怀疑是因为你没有给对应控件增加 id。 import Taro, { Component } from '@tarojs/taro'
import { View, RadioGroup, Label, Radio, Icon } from '@tarojs/components'
export default class PageView extends Component {
state = {
ous: [{
id: 0,
title: 'zero',
selected: false
}, {
id: 1,
title: 'one',
selected: false
}, {
id: 2,
title: 'two',
selected: false
}]
}
handleChange (e) {
this.setState(prevState => {
const cur = e.detail.value
const ous = prevState.ous.map((ou, index) => {
if (index == cur) {
ou.selected = true
} else {
ou.selected = false
}
return ou
})
return { ous }
})
}
render() {
const ous = this.state.ous
return (
<View>
<RadioGroup onChange={this.handleChange}>
{ous.map(ou =>
<Label key={ou.id} for={ou.id}>
<Radio id={ou.id} value={ou.id} checked={ou.selected}></Radio>
<View >{ou.title}</View>
{ou.selected &&
<View>
<Icon type='success_no_circle' size='16' />
</View>
}
</Label>
)}
</RadioGroup>
</View>
)
}
} |
谢谢, 是我的问题 |
问题描述
RadioGroup 点击最后一个Radio, onChange事件没有触发. 只有点击前面的一个Radio之后, 再点击最后一个Radio, onChange事件才能触发.
另外Label中加了for属性, onChange都没法触发了
期望行为
最后一个Radio可以触发onChange事件
报错信息
[这里请贴上你的完整报错截图或文字]
系统信息
The text was updated successfully, but these errors were encountered: