SelectAll组件:
import React from 'react'
import { Select } from 'antd'
class SelectAll extends React.Component{
constructor(props){
super(props)
}
componentDidMount(){
// console.log(this.props.children)
}
componentDidUpdate(){
console.log(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(){
return (
<Select maxTagCount={2} mode="multiple" {...this.props} onChange={this.onChange}>
<Select.Option key