We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#####我尝试通过高阶组件实现Select全选功能,可惜antd2.x并不支持,能否在vtx-ui2.x版本中加入这个功能?
import React from 'react' import { Select } from 'antd' const { Option } = Select class SelectAll extends React.Component { constructor(props) { super(props) } componentDidMount() { // console.log(this.props.children) } componentDidUpdate() { console.log('selectChildren', this.props.children) } onChange = (key, item) => { if (key.includes('all')) { if (this.props.value?.length === this.props.children?.length) { this.props.onChange([]) } else { let keyArr = this.props.children?.map(x => { return x.key }) this.props.onChange(keyArr) } } else { this.props.onChange(key) } } render() { console.log('this.props.children>>>>>>>>>', this.props.children); return ( <Select mode="multiple" {...this.props} onChange={this.onChange}> <Option key="all"> 全选 </Option> {!!this.props.children?.length ? this.props.children : null} </Select> ) } } export default SelectAll;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
#####我尝试通过高阶组件实现Select全选功能,可惜antd2.x并不支持,能否在vtx-ui2.x版本中加入这个功能?
The text was updated successfully, but these errors were encountered: