配置路由
This commit is contained in:
parent
d3e29a51f0
commit
1a554224ed
@ -1,8 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="layout_main">
|
<div class="layout_main">
|
||||||
|
<router-view v-slot="{ Component }">
|
||||||
<transition name="fade-transform" mode="out-in">
|
<transition name="fade-transform" mode="out-in">
|
||||||
<router-view />
|
<component :is="Component" />
|
||||||
</transition>
|
</transition>
|
||||||
|
</router-view>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@ -1,6 +1,19 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const emit = defineEmits(["btnCut"])
|
||||||
|
const { cut } = defineProps(["cut"])
|
||||||
|
const btnCut = () => {
|
||||||
|
emit("btnCut")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<nav>
|
<nav>
|
||||||
<div>首页</div>
|
<div class="text">
|
||||||
|
<el-icon size="20" @click="btnCut">
|
||||||
|
<Fold v-if="cut" />
|
||||||
|
<Expand v-else />
|
||||||
|
</el-icon>
|
||||||
|
<span>首页</span>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
<div class="el_dropdown">
|
<div class="el_dropdown">
|
||||||
@ -36,5 +49,10 @@ nav {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,18 +1,27 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
const { cut } = defineProps(["cut"])
|
||||||
|
const routerList = useRouter().options.routes[0]?.children
|
||||||
|
console.log(routerList);
|
||||||
|
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="side_bar">
|
<div class="side_bar" :style="{ width: cut ? '250px' : '80px' }">
|
||||||
<div class="title">调压通后台管理系统</div>
|
<div class="title"> {{ cut ? "调压通后台管理系统" : "调压通" }}</div>
|
||||||
<el-menu default-active="1" class="menu" mode="vertical" background-color="#304156" text-color="#bfcbd9"
|
<el-menu router :collapse="!cut" default-active="/overview" class="menu" background-color="#304156"
|
||||||
active-text-color="#409EFF">
|
text-color="#bfcbd9" active-text-color="#409EFF">
|
||||||
<el-menu-item index="1">Processing Center</el-menu-item>
|
<el-menu-item class="menu_item" v-for="route in routerList" :key="route.name" :index="route.path">
|
||||||
<el-menu-item index="3" disabled>Info</el-menu-item>
|
<i class="iconfont" :class="route.meta?.icon"></i>
|
||||||
<el-menu-item index="4">Orders</el-menu-item>
|
<span>{{ route.meta?.title }}</span>
|
||||||
|
</el-menu-item>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.side_bar {
|
.side_bar {
|
||||||
width: 250px;
|
|
||||||
background-color: #304156;
|
background-color: #304156;
|
||||||
|
transition: all 0.3s;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
background-color: #2b2f3a;
|
background-color: #2b2f3a;
|
||||||
@ -26,6 +35,10 @@
|
|||||||
|
|
||||||
.menu {
|
.menu {
|
||||||
border-right: none;
|
border-right: none;
|
||||||
|
|
||||||
|
i {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -2,12 +2,17 @@
|
|||||||
import Sidebar from "./components/Sidebar.vue";
|
import Sidebar from "./components/Sidebar.vue";
|
||||||
import Navbar from "./components/Navbar.vue";
|
import Navbar from "./components/Navbar.vue";
|
||||||
import Appmain from "./components/AppMain.vue";
|
import Appmain from "./components/AppMain.vue";
|
||||||
|
import { ref } from "vue";
|
||||||
|
const cut = ref(true)
|
||||||
|
const btnCut = () => {
|
||||||
|
cut.value = !cut.value
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<Sidebar></Sidebar>
|
<Sidebar :cut="cut"></Sidebar>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<Navbar></Navbar>
|
<Navbar @btn-cut="btnCut" :cut="cut"></Navbar>
|
||||||
<Appmain></Appmain>
|
<Appmain></Appmain>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,17 +1,40 @@
|
|||||||
import { createMemoryHistory, createRouter } from "vue-router";
|
import { createMemoryHistory, createRouter } from "vue-router";
|
||||||
import Layout from "@/Layout/index.vue";
|
import Layout from "@/Layout/index.vue";
|
||||||
import AboutView from "@/views/login/index.vue";
|
import Login from "@/views/login/index.vue";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: "/home",
|
redirect: "/overview",
|
||||||
children: [
|
children: [
|
||||||
{ path: "/home", component: () => import("@/views/home/index.vue") },
|
{
|
||||||
|
path: "/overview",
|
||||||
|
name: "Overview",
|
||||||
|
component: () => import("@/views/overview/index.vue"),
|
||||||
|
meta: { title: "数据概览", icon: "icon-shujugailan" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/surgery",
|
||||||
|
name: "Surgery",
|
||||||
|
component: () => import("@/views/surgery/index.vue"),
|
||||||
|
meta: { title: "手术记录", icon: "icon-bijijilu" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/device",
|
||||||
|
name: "Device",
|
||||||
|
component: () => import("@/views/device/index.vue"),
|
||||||
|
meta: { title: "设备管理", icon: "icon-shebeigailan" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/statistics",
|
||||||
|
name: "Statistics",
|
||||||
|
component: () => import("@/views/statistics/index.vue"),
|
||||||
|
meta: { title: "统计分析", icon: "icon-tongji" },
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ path: "/login", component: AboutView },
|
{ path: "/login", component: Login },
|
||||||
];
|
];
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
|
|||||||
7
src/views/device/index.vue
Normal file
7
src/views/device/index.vue
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<script setup lang='ts'></script>
|
||||||
|
<template>
|
||||||
|
<div class="equipment">
|
||||||
|
<h1>设备管理</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<style scoped></style>
|
||||||
5
src/views/overview/index.vue
Normal file
5
src/views/overview/index.vue
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<div class="data">
|
||||||
|
<h1>数据概览</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
7
src/views/statistics/index.vue
Normal file
7
src/views/statistics/index.vue
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<script setup lang='ts'></script>
|
||||||
|
<template>
|
||||||
|
<div class="statistics">
|
||||||
|
<h1>统计分析</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<style scoped></style>
|
||||||
7
src/views/surgery/index.vue
Normal file
7
src/views/surgery/index.vue
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<script setup lang='ts'></script>
|
||||||
|
<template>
|
||||||
|
<div class="surgery">
|
||||||
|
<h1>手术记录</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<style scoped></style>
|
||||||
Loading…
x
Reference in New Issue
Block a user