我将如何获得父母的高度



我正在创建一个文档上传系统,并希望将上传的所有文档的行组成,最后一行是"添加另一个文档"行。当前,带有行的列表容器没有扩展,而只是降低了列表中项目的高度。相反,我正在尝试使父高度扩展以将所有项目包括在列表中。任何帮助都将受到赞赏!

import React, { Component } from 'react';
export class Upload extends Component {
    render() {
        return (
            <div style={{'height': '100vh', 'display': 'flex', 'justifyContent': 'center', alignItems: 'center'}}>
                    <div style={{'flex': 0.8, maxWidth: 800, flexGrow: 1, 'borderRadius': 10, 'boxShadow': '0px 0px 10px #82828240', 'paddingLeft': 50, 'paddingRight': 50, 'paddingTop': 100, 'paddingBottom': 100, display: 'flex', flexDirection: 'column'}}>
                        <div>
                            <h2>Document upload</h2>
                            <p>Some subtitle placeholder</p>
                        </div>
                        <hr />
                        <div style={{'display': 'flex','flexDirection': 'column', backgroundColor: 'red'}}>
                            <div style={{flex: 1, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            <div style={{flex: 1, flexShrink: 0, backgroundColor: 'blue', marginTop: 20, marginBottom: 20}} />
                            {/* <button type='button' style={{'flex': 1, flexShrink: 0, 'borderStyle': 'dashed'}} onClick={() => this.input.click()}/>
                            <input id='file-upload' type="file" style={{display: 'none'}} ref={(input) => this.input = input}/> */}
                        </div>
                    </div>
            </div>
        );
    }
}

删除height: 80%,然后将li更改为div

最新更新