| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import React, {Component} from 'react';
- import {Layout, Menu } from 'antd';
- import Deploy from '../common/deploy/Deploy';
- import Api from "./api/Api";
- const { Content } = Layout;
- class CloudFunction extends Component {
- constructor() {
- super();
- this.state = {
- menuLevel2: "deploy",
- }
- }
- switchMenu = (menuName, e) => {
- // console.log('menuName', menuName, 'e', e);
- this.setState({
- [menuName]: e.key,
- });
- };
- render() {
- return (
- <div>
- <Menu
- mode="horizontal"
- defaultSelectedKeys={['deploy']}
- style={{padding: '0 24px', position: 'fixed', width: '100%', zIndex: '1'}}
- onClick={(e) => this.switchMenu('menuLevel2', e)}
- selectedKeys={[this.state.menuLevel2]}
- >
- <Menu.Item key="deploy">deploy</Menu.Item>
- <Menu.Item key="api">API</Menu.Item>
- </Menu>
- <Layout style={{ padding: '24px', zIndex: '0'}}>
- <Content style={{ padding: '24px', minHeight: 280, background: '#fff',marginTop: '48px' }}>
- {(() => {
- switch (this.state.menuLevel2) {
- case 'deploy':
- return <Deploy />;
- case 'api':
- return <Api />;
- default:
- return <Deploy />
- }
- })()}
- </Content>
- </Layout>
- </div>
- )
- }
- }
- export default CloudFunction;
|