Ai
4 Star 4 Fork 5

WeiboGe2012/自动化测试平台vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Asidebar.vue 2.80 KB
一键复制 编辑 原始数据 按行查看 历史
WeiboGe2012 提交于 2021-01-21 15:06 +08:00 . 1.UI更新2.菜单优化
<template>
<div>
<el-menu default-active="1-4-1" class="el-menu-vertical-demo" :collapse="myshow" @open="handleOpen" @close="handleClose">
<nuxt-link class="wenzi" to="/frontsystem">
<div class="logobox" style="margin-bottom: 20px;">
<img class="logoimg" src="../assets/img/peony.png">
</div>
</nuxt-link>
<el-submenu v-for="menu in allmenu" :key="menu.menuid" :index="menu.name">
<template slot="title">
<svg-icon :icon-class="menu.icon" />
<span>{{ menu.name }}</span>
</template>
<el-menu-item-group>
<nuxt-link v-for="chmenu in menu.children" :key="chmenu.menuid" class="wenzi" :to="chmenu.path">
<el-menu-item id="el-menu-item-id" :index="menu.sort + '-' + chmenu.sort">
<svg-icon :icon-class="chmenu.icon" />
<span>{{ chmenu.name }}</span>
</el-menu-item>
</nuxt-link>
</el-menu-item-group>
</el-submenu>
<el-menu-item index="4" disabled>
<i class="el-icon-document" />
<span slot="title">导航三</span>
</el-menu-item>
<el-menu-item index="5">
<i class="el-icon-setting" />
<span slot="title">导航四</span>
</el-menu-item>
</el-menu>
</div>
</template>
<script>
import { listMenu } from '@/api/userMG'
export default {
props: {
myshow: Boolean
},
data () {
return {
allmenu: []
}
},
/**
* 创建完毕
*/
created () {
this.getdata(this.formInline)
},
methods: {
// 获取菜单列表
getdata (parameter) {
this.loading = true
/***
* 调用接口,注释上面模拟数据 取消下面注释
*/
listMenu(parameter)
.then((res) => {
this.loading = false
if (res.code !== 0) {
this.$message({
type: 'info',
message: res.msg
})
} else {
this.allmenu = res.data
}
})
// eslint-disable-next-line handle-callback-err
.catch((err) => {
this.loading = false
this.$message.error('菜单加载失败,请稍后再试!')
})
},
handleOpen (key, keyPath) {
// eslint-disable-next-line no-console
console.log(key, keyPath)
},
handleClose (key, keyPath) {
// eslint-disable-next-line no-console
console.log(key, keyPath)
}
}
}
</script>
<style lang="scss">
.el-menu-vertical-demo:not(.el-menu--collapse) {
width: 150px;
min-height: 100%;
}
.el-menu--popup {
min-width: 100px;
}
.wenzi {
text-decoration:none;
}
.logobox {
height: 40px;
line-height: 40px;
color: #9d9d9d;
font-size: 20px;
text-align: center;
padding: 10px 0px;
}
.logoimg {
height: 40px;
}
</style>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/WeiboGe2012/automated-test-platform-vue.git
git@gitee.com:WeiboGe2012/automated-test-platform-vue.git
WeiboGe2012
automated-test-platform-vue
自动化测试平台vue
master

搜索帮助