简化demo
This commit is contained in:
parent
20d9185ba8
commit
28acd42a2e
|
@ -81,8 +81,7 @@ class Demo1 extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
data: data,
|
data: data,
|
||||||
factoryValue: 0,
|
selectedRowIndex: 0
|
||||||
selectedRow: new Array(data.length)//状态同步
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,18 +91,15 @@ class Demo1 extends Component {
|
||||||
columns={columns}
|
columns={columns}
|
||||||
data={data}
|
data={data}
|
||||||
rowClassName={(record,index,indent)=>{
|
rowClassName={(record,index,indent)=>{
|
||||||
if (this.state.selectedRow[index]) {
|
if (this.state.selectedRowIndex == index) {
|
||||||
return 'selected';
|
return 'selected';
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onRowClick={(record,index,indent)=>{
|
onRowClick={(record,index,indent)=>{
|
||||||
let selectedRow = new Array(this.state.data.length);
|
this.setState({
|
||||||
selectedRow[index] = true;
|
selectedRowIndex: index
|
||||||
this.setState({
|
|
||||||
factoryValue: record,
|
|
||||||
selectedRow: selectedRow
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
title={currentData => <div>标题: 这是一个标题</div>}
|
title={currentData => <div>标题: 这是一个标题</div>}
|
||||||
|
|
Loading…
Reference in New Issue