下面的函数在我的渲染函数之上,有什么不对吗?它似乎不允许我把功能放在功能中。
onSelected(i){
this.state.active = [];
this.state.active[i] = true;
generateRangeFromIndex(index,steps=20){
return [index*steps, index*steps+steps]
}
this.setState({
active: this.state.active,
showHandler: true,
selectedRange: generateRangeFromIndex(i)
});
}
答案 0 :(得分:0)
onSelected(i){
this.state.active = [];
this.state.active[i] = true;
let t = this;
this.setState({
active: this.state.active,
showHandler: true,
selectedRange: t.generateRangeFromIndex(i)
});
}
generateRangeFromIndex(index,steps=20){
return [index*steps, index*steps+steps]
}