<div className="col-md-10">
<select name="" onChange={(e) => this.onFirstCategoryChange(e)} className="form-control cate-select">
<option value="">请选择一级分类</option>
{
//箭头函数=>右边,加上了{}就需要return,不加就不需要return
this.state.firstCategoryList.map(
(category, index) => <option value={category.id} key={index}>{category.name}</option>)
}
</select>
{ this.state.secondCategoryList.length ?
<select name="" onChange={(e) => this.onSecondCategoryChange(e)} className="form-control cate-select">
<option value="">请选择二级分类</option>
{
this.state.secondCategoryList.map(
(category, index)=> <option value={category.id} key={index}>{category.name}</option>
)
}
</select> : null
}
</div>