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

[antd 1.0.1]Select组件onChange的第二参数总是undefined #1695

Closed
pixystone opened this issue May 13, 2016 · 4 comments
Closed

[antd 1.0.1]Select组件onChange的第二参数总是undefined #1695

pixystone opened this issue May 13, 2016 · 4 comments
Assignees

Comments

@pixystone
Copy link
Contributor

handleChange(selectKeys, labels) {
    console.log(selectKeys, labels);
}
<Select {...otherProps}
              multiple
              showSearch searchPlaceholder="模糊搜索"
              placeholder="选择方案配置, 最多两个"
              optionFilterProp="children"
              onChange={this.handleChange}
              notFoundContent="获取中..."
              value={this.props.value}>
  {this.state.data.map(record => <Select.Option key={record.id} value={record.sid}>{`${record.sid} - `}{record.taskName}</Select.Option>)}
</Select>

otherProps是form传入的一些属性,onChange在之后又一次赋值,应该不是form的onChange

console打印:

[1005] undefined
@ddcat1115
Copy link
Contributor

1.0.0之后,onChange不再单独传递label,如果需要得到label,可以用labelInValue的方式,稍后会更新文档及示例

superRaytin added a commit that referenced this issue May 19, 2016
@afc163
Copy link
Member

afc163 commented May 19, 2016

更新到 1.0.0 的 Changelog 里去吧。

@benjycui
Copy link
Contributor

benjycui commented Nov 8, 2016

labelInValue 替代 onChange 第二个参数的考虑是?

@lock
Copy link

lock bot commented May 3, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants