1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- import { css } from "@linaria/core";
- import { Layout, Menu, Spin } from "ant-design-vue";
- import { defineComponent, onMounted, reactive } from "vue";
- import { useRoute } from "vue-router";
- import { InitControllers } from "@/comm/ctx";
- import { menuData } from "@/pages/website/routes";
- const { Sider, Content } = Layout;
- export default defineComponent({
- setup() {
- const state = reactive({
- loading: true,
- menuKey: ["/backend/upload"],
- });
- const menuChange = (keyPath: any) => {
- state.menuKey = keyPath;
- };
- onMounted(() => {
-
- const data = useRoute();
- state.menuKey = [data.path];
- });
- return () => {
-
- return (
- <Layout class={HomeStyle}>
- <Sider width={200} trigger={null} collapsible>
- <div class="layout_menu">
- <Menu
- theme="dark"
- selectedKeys={state.menuKey}
- mode="inline"
- onSelect={(item: any) => {
- menuChange(item.keyPath);
- }}
- >
- {menuData?.children &&
- menuData.children.map((menu: any) => {
- return (
- <Menu.Item key={menu.path}>
- <router-link to={menu.path}>
- {menu.meta.title}
- </router-link>
- </Menu.Item>
- );
- })}
- </Menu>
- </div>
- </Sider>
- <Layout>
- <Content
- class="layout_background"
- style={{
- margin: "24px 16px",
- minHeight: 280,
- }}
- >
- <router-view />
- </Content>
- </Layout>
- </Layout>
- );
- };
- },
- });
- const HomeStyle = css`
- width: 100%;
- min-height: 100vh;
- .ant-layout-content {
- flex: 1;
- overflow: auto;
- }
- .layout_background {
- background-color: #fff;
- }
- .layout_menu {
- margin-top: 64px;
- }
- .header_right {
- text-align: right;
- }
- `;
|