1. When using the Select selector, we all know that we can use value值
the selected properties to get.
默认根据此属性值进行筛选
function handleChange(value) {
console.log(`selected ${
value}`);
}
2. But when we need to get multiple attribute values, in fact, the selector also has optional attributes for selection.
So when we need to get multiple attribute values, we can assign the value to title与className
3. Example:
return (
<Option value={
index} title={
item.startDate} className={
item.endDate} key={
}>{
`${
item.year}-${
item.endYear}学年${
item.semester}`}</Option>
)
handleChangeSemester = (value, e) => {
const {
attendanceStatisticsSection: {
semesterTime },
} = this.props;
// 将学期范围和学期码传入下一页面
this.setState({
startDateRange: e.props.title,
endDateRange: e.props.className,
initSemesterCode: semesterTime[value].semesterCode,
})
如此我们即可在回调函数中获取多个属性值