【发布时间】:2017-10-04 22:51:30
【问题描述】:
我正在尝试使用 React Material Design 创建响应式侧边栏,但找不到方法。
侧边栏打开时页面内容应该是响应式的,并且侧边栏不应该覆盖在页面内容上。
它应该看起来像https://blackrockdigital.github.io/startbootstrap-simple-sidebar/。
目前的代码是:
import React from 'react';
import Drawer from 'material-ui/Drawer';
import AppBar from 'material-ui/AppBar';
import RaisedButton from 'material-ui/RaisedButton';
import Layout from 'material-ui/RaisedButton';
export default class DrawerOpenRightExample extends React.Component {
constructor(props) {
super(props);
this.state = {open: false};
}
handleToggle(){
this.setState({open: !this.state.open});
}
render() {
return (
<div>
<container>
//will have a form here
<RaisedButton
label="Toggle Drawer"
onTouchTap={this.handleToggle.bind(this)}
/>
</container>
<Drawer width={400} openSecondary={true} open={this.state.open} >
<AppBar title="AppBar" />
</Drawer>
</div>
);
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
【问题讨论】:
标签: javascript reactjs material-ui refluxjs