简体   繁体   English

如何使用MaterialUI构建此布局? 应对

[英]How can I build this layout with MaterialUI? React

I'm using MaterialUI to build my UI with React. 我正在使用MaterialUI用React构建我的UI。 I want to build a layout like this: 我想建立这样的布局: 在此处输入图片说明

I'm handling with the Grid's components and playing around but need help to put that column :c any idea? 我正在处理Grid的组件并在玩耍,但是需要帮助来放置该列:c有什么想法吗? Thanks. 谢谢。

Additional Details: * I've not thought in a responsive if you know a way to make it mobile it would be helpful 其他详细信息:*如果您知道使之移动的方法,我认为不会有所响应,这会有所帮助

Thanks! 谢谢!

I'll grant that it's not the sexiest solution, but I believe the easiest route would be to use Material-UI's various Table components to create two columns and then nest your grid or a table in the first column. 我承认这不是最性感的解决方案,但我认为最简单的方法是使用Material-UI的各种Table组件创建两个列,然后将网格或表嵌套在第一列中。 If someone has a better alternative, please comment so I can learn, too! 如果有人有更好的选择,请发表评论,以便我也能学习!

In my example snippet, I reused the Table components to nest a table. 在我的示例代码段中,我重用了Table组件来嵌套表。 I didn't get the styling to match yours precisely but close enough for a workable starting point. 我没有样式可以精确地匹配您的样式,但足够接近以适合可行的起点。

 const { Table, TableBody, TableRow, TableCell } = window["material-ui"]; const NestedTableExample = () => { const sharedColumnProps = { border: "none" }; const sharedDivProps = { border: "solid 3px #000", height: "100%", padding: "10px", width: "100%" }; const styles = { column1: { width: "150px", ...sharedColumnProps }, column1Div: { background: "lightblue", ...sharedDivProps }, column2: { width: "50px", ...sharedColumnProps }, column2Div: { background: "orange", ...sharedDivProps } }; return ( <Table style={{ height: "100%" }}> <TableBody> <TableRow> <TableCell style={{ border: "none" }}> <Table> <TableBody> <TableRow> <TableCell style={styles.column1}> <div style={styles.column1Div}>Cell1</div> </TableCell> </TableRow> <TableRow> <TableCell style={styles.column1}> <div style={styles.column1Div}>Cell2</div> </TableCell> </TableRow> <TableRow> <TableCell style={styles.column1}> <div style={styles.column1Div}>Cell3</div> </TableCell> </TableRow> </TableBody> </Table> </TableCell> <TableCell style={styles.column2}> <div style={styles.column2Div}>Cell4</div> </TableCell> </TableRow> </TableBody> </Table> ); }; ReactDOM.render(<NestedTableExample />, document.getElementById("app")); 
 <script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script> <script src="https://unpkg.com/@material-ui/core@3.6.2/umd/material-ui.production.min.js"></script> <div id="app"></div> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 react 和 materialUI 控制来自另一个模块的对话框 - How can I control a dialog from another module with react and materialUI 如何在 MaterialUI 中布局 forms? - How do I layout forms in MaterialUI? 如何理解MaterialUI样式的组件? - How can I understand MaterialUI styled component? 如何加粗 MaterialUI 上的下划线<link> ? - How can I thicken the underline on a MaterialUI <Link>? React/MaterialUI - 如何在我的 object 中将每个 JSON 数组 map 放到它自己的单独表中? - React/MaterialUI - How can I map each JSON array in my object to it's own separate table? 如何更改 MaterialUI 的 React Tabs 组件的下划线颜色? - How can I change the underline color of MaterialUI's React Tabs component? 如何更改MaterialUi中Slide组件的动画定时功能 - How can I change animation-timing-function for Slide component in MaterialUi react 我正在构建一个需要 pdf 下载的 React 应用程序,如果单击(materialUI)下载按钮,我该如何添加该功能? - Im building a React App that requires a pdf to download, in the event the (materialUI) download button is clicked, how can I add that functionality? React/MaterialUI - 如何编辑我的多输入以显示与我的选项中的占位符不同的占位符? - React/MaterialUI - How can I edit my multiple-input to display a different placeholder other than those in my options? 如何将 MaterialUI TextField 的值设置为大写? - How can I set the value of my MaterialUI TextField to uppercase?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM