测试菜单栏简单实现

This commit is contained in:
haifeng414 2020-02-13 15:38:03 +08:00
parent 10a9991252
commit 40f2763fa6
3 changed files with 51 additions and 10 deletions

View File

@ -10,7 +10,9 @@
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-row type="flex" justify="center" align="middle"> <el-row type="flex" justify="center" align="middle">
<el-button type="primary" size="small" @click="createTest">创建测试</el-button> <router-link to="/createTest">
<el-button type="primary" size="small">创建测试</el-button>
</router-link>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
@ -49,9 +51,6 @@
}, },
components: {MsWebSocket, MsUser, MsMenus, MsSetting, MsView}, components: {MsWebSocket, MsUser, MsMenus, MsSetting, MsView},
methods: { methods: {
createTest() {
this.$router.push({path: '/createTest'})
}
} }
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" <el-menu class="header-menu" :unique-opened="true" mode="horizontal" router
menu-trigger="click"> menu-trigger="click">
<el-menu-item index="1"><a href="/" style="text-decoration: none;">{{ $t("i18n.home") }}</a></el-menu-item> <el-menu-item index="1"><a href="/" style="text-decoration: none;">{{ $t("i18n.home") }}</a></el-menu-item>
<el-submenu index="2" popper-class="submenu"> <el-submenu index="2" popper-class="submenu">
@ -19,10 +19,8 @@
</el-submenu> </el-submenu>
<el-submenu index="4" popper-class="submenu"> <el-submenu index="4" popper-class="submenu">
<template slot="title">测试</template> <template slot="title">测试</template>
<el-menu-item index="4-1">测试1</el-menu-item> <recent-test-plan/>
<el-menu-item index="4-2">测试2</el-menu-item> <el-menu-item index="/createTest">
<el-menu-item index="4-3">显示全部</el-menu-item>
<el-menu-item index="create-test" route="{path:'test'}">
<el-button type="text">创建测试</el-button> <el-button type="text">创建测试</el-button>
</el-menu-item> </el-menu-item>
</el-submenu> </el-submenu>
@ -36,8 +34,11 @@
</template> </template>
<script> <script>
import RecentTestPlan from "./testPlan/RecentTestPlan";
export default { export default {
name: "MsMenus" name: "MsMenus",
components: {RecentTestPlan}
} }
</script> </script>

View File

@ -0,0 +1,41 @@
<template>
<div>
<div class="recent-text">
<i class="el-icon-time"/>
最近的测试
</div>
<el-menu-item v-bind:key="recentTestPlan.id" v-for="recentTestPlan in recentTestPlans">
{{ recentTestPlan.name }}
</el-menu-item>
</div>
</template>
<script>
export default {
name: "RecentTestPlan",
data() {
return {
recentTestPlans: [{
id: 1,
name: "测试1"
}, {
id: 2,
name: "测试2"
}, {
id: 3,
name: "测试3"
}, {
id: 4,
name: "测试4"
}]
}
}
}
</script>
<style scoped>
.recent-text {
padding-left: 10%;
color: #777777;
}
</style>