- 优化 resourceList 不展开问题
This commit is contained in:
parent
0c8a79a8ed
commit
4a3e8e2843
@ -99,7 +99,6 @@ class ResourceList extends PureComponent {
|
|||||||
modalVisible: false,
|
modalVisible: false,
|
||||||
modalType: 'add', //add update
|
modalType: 'add', //add update
|
||||||
initValues: {},
|
initValues: {},
|
||||||
defaultExpandAllRows: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@ -110,12 +109,6 @@ class ResourceList extends PureComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
changeExpandAll() {
|
|
||||||
this.setState({
|
|
||||||
defaultExpandAllRows: !this.state.defaultExpandAllRows,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleModalVisible = (flag, modalType, initValues) => {
|
handleModalVisible = (flag, modalType, initValues) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
modalVisible: !!flag,
|
modalVisible: !!flag,
|
||||||
@ -175,7 +168,7 @@ class ResourceList extends PureComponent {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { list } = this.props;
|
const { list } = this.props;
|
||||||
const { modalVisible, modalType, initValues, defaultExpandAllRows } = this.state;
|
const { modalVisible, modalType, initValues } = this.state;
|
||||||
const parentMethods = {
|
const parentMethods = {
|
||||||
handleAdd: this.handleAdd,
|
handleAdd: this.handleAdd,
|
||||||
handleModalVisible: this.handleModalVisible,
|
handleModalVisible: this.handleModalVisible,
|
||||||
@ -250,18 +243,9 @@ class ResourceList extends PureComponent {
|
|||||||
>
|
>
|
||||||
新建
|
新建
|
||||||
</Button>
|
</Button>
|
||||||
<Button type="normal" onClick={() => this.changeExpandAll()}>
|
|
||||||
展开所有行
|
|
||||||
</Button>
|
|
||||||
TODO 展开没效果,需要研究下
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Table
|
<Table defaultExpandAllRows={true} columns={columns} dataSource={list} rowKey="id" />
|
||||||
defaultExpandAllRows={defaultExpandAllRows}
|
|
||||||
columns={columns}
|
|
||||||
dataSource={list}
|
|
||||||
rowKey="id"
|
|
||||||
/>
|
|
||||||
</Card>
|
</Card>
|
||||||
<CreateForm {...parentMethods} modalVisible={modalVisible} />
|
<CreateForm {...parentMethods} modalVisible={modalVisible} />
|
||||||
</PageHeaderWrapper>
|
</PageHeaderWrapper>
|
||||||
|
Loading…
Reference in New Issue
Block a user