Browse Source

handcode and use Automatically closed menu

pull/2088/head
陈帅 8 years ago
parent
commit
6180e59cdb
  1. 3
      config/router.config.js
  2. 2
      package.json
  3. 1
      src/components/GlobalHeader/index.less
  4. 35
      src/components/TopNavHeader/index.js
  5. 4
      src/components/TopNavHeader/index.less
  6. 2
      src/pages/404.js

3
config/router.config.js

@ -249,6 +249,9 @@ module.exports = [
}, },
], ],
}, },
{
component: '404',
},
], ],
}, },
]; ];

2
package.json

@ -25,7 +25,7 @@
"dependencies": { "dependencies": {
"@antv/data-set": "^0.9.0", "@antv/data-set": "^0.9.0",
"@babel/runtime": "^7.0.0", "@babel/runtime": "^7.0.0",
"antd": "^3.9.0-beta.2", "antd": "3.9.0-beta.6",
"bizcharts": "^3.1.10", "bizcharts": "^3.1.10",
"bizcharts-plugin-slider": "^2.0.3", "bizcharts-plugin-slider": "^2.0.3",
"classnames": "^2.2.6", "classnames": "^2.2.6",

1
src/components/GlobalHeader/index.less

@ -45,6 +45,7 @@ i.trigger {
.right { .right {
float: right; float: right;
height: 100%; height: 100%;
width: 324px;
.action { .action {
cursor: pointer; cursor: pointer;
padding: 0 12px; padding: 0 12px;

35
src/components/TopNavHeader/index.js

@ -5,11 +5,31 @@ import BaseMenu from '../SiderMenu/BaseMenu';
import styles from './index.less'; import styles from './index.less';
export default class TopNavHeader extends PureComponent { export default class TopNavHeader extends PureComponent {
constructor(props) {
super(props);
this.state = {
maxWidth: (props.grid === 'Wide' ? 1200 : window.innerWidth) - 324 - 165 - 4,
};
}
static getDerivedStateFromProps(props) {
return {
maxWidth: (props.grid === 'Wide' ? 1200 : window.innerWidth) - 324 - 165 - 4,
};
}
render() { render() {
const { theme, grid, logo } = this.props; const { theme, grid, logo } = this.props;
const { maxWidth } = this.state;
return ( return (
<div className={`${styles.head} ${theme === 'light' ? styles.light : ''}`}> <div className={`${styles.head} ${theme === 'light' ? styles.light : ''}`}>
<div className={`${styles.main} ${grid === 'Wide' ? styles.wide : ''}`}> <div
ref={ref => {
this.maim = ref;
}}
className={`${styles.main} ${grid === 'Wide' ? styles.wide : ''}`}
>
<div className={styles.left}> <div className={styles.left}>
<div className={styles.logo} key="logo" id="logo"> <div className={styles.logo} key="logo" id="logo">
<Link to="/"> <Link to="/">
@ -17,11 +37,16 @@ export default class TopNavHeader extends PureComponent {
<h1>Ant Design Pro</h1> <h1>Ant Design Pro</h1>
</Link> </Link>
</div> </div>
<BaseMenu {...this.props} style={{ paddingTop: '9px', border: 'none' }} /> <div
</div> style={{
<div className={styles.right}> flex: 1,
<RightContent {...this.props} /> maxWidth,
}}
>
<BaseMenu {...this.props} style={{ border: 'none', height: 64 }} />
</div>
</div> </div>
<RightContent {...this.props} />
</div> </div>
</div> </div>
); );

4
src/components/TopNavHeader/index.less

@ -8,6 +8,7 @@
:global { :global {
.ant-menu-submenu.ant-menu-submenu-horizontal { .ant-menu-submenu.ant-menu-submenu-horizontal {
height: 100%; height: 100%;
padding-top: 9px;
.ant-menu-submenu-title { .ant-menu-submenu-title {
height: 100%; height: 100%;
} }
@ -29,6 +30,9 @@
flex: 1; flex: 1;
display: flex; display: flex;
} }
.right {
width: 324px;
}
} }
} }

2
src/pages/404.js

@ -3,5 +3,5 @@ import Link from 'umi/link';
import Exception from '@/components/Exception'; import Exception from '@/components/Exception';
export default () => ( export default () => (
<Exception type="404" linkElement={Link} /> <Exception type="404" style={{ minHeight: 500, height: '100%' }} linkElement={Link} />
); );

Loading…
Cancel
Save