ADD file via upload

main
pjhmizn49 1 year ago
parent 48c6049058
commit 8121655adb

@ -0,0 +1,164 @@
<template>
<el-menu
default-active="1-4-1"
class="el-menu-vertical-demo"
:collapse="isCollapse"
background-color="#545c64"
text-color="#fff"
active-text-color="#ffd04b"
style="border: none;"
>
<h3 style="white-space:nowrap;color: #fff;text-align: center;line-height: 48px;font-size: 16px;">
{{ isCollapse ? '后台' :'花店后台管理系统' }}
</h3>
<el-submenu v-for="item in hasChildren" :key="item.label" :index="item.label">
<template slot="title">
<i :class="item.icon"></i>
<span slot="title">{{ item.label }}</span>
</template>
<el-menu-item-group v-for="subItem in item.children" :key="subItem.name" >
<el-menu-item @click="clickMenu(subItem)" :index="subItem.name">
<i :class="subItem.icon"></i>
{{ subItem.label }}
</el-menu-item>
</el-menu-item-group>
</el-submenu>
<el-menu-item @click="clickMenu(item)" v-for="item in noChildren" :key="item.name" :index="item.name">
<i :class="item.icon"></i>
<span slot="title">{{ item.label }}</span>
</el-menu-item>
</el-menu>
</template>
<script>
import Cookie from "js-cookie";
export default {
data() {
return {
// menuData: [
// {
// path: "/statistic",
// name: "statistic",
// label: "",
// icon: "el-icon-data-line",
// url: "statistic/statistic",
// },
// {
// label: "",
// icon: "el-icon-user",
// children: [
// {
// path: "/user",
// name: "user",
// label: "",
// icon: "el-icon-user-solid",
// url: "user/user",
// },
// {
// path: "/staff",
// name: "staff",
// label: "",
// icon: "el-icon-s-custom",
// url: "staff/staff",
// },
// ],
// },
// {
// label: "",
// icon: "el-icon-box",
// children: [
// {
// path: "/class",
// name: "class",
// label: "",
// icon: "el-icon-menu",
// url: "class/class",
// },
// {
// path: "/flower",
// name: "flower",
// label: "",
// icon: "el-icon-star-on",
// url: "flower/flower",
// },
// {
// path: "/pack",
// name: "pack",
// label: "",
// icon: "el-icon-s-shop",
// url: "pack/pack",
// },
// ],
// },
// {
// path: "/order",
// name: "order",
// label: "",
// icon: "el-icon-document",
// url: "order/order",
// },
// {
// path: "/discount",
// name: "discount",
// label: "",
// icon: "el-icon-shopping-bag-1",
// url: "discount/discount",
// },
// {
// path: "/notice",
// name: "notice",
// label: "",
// icon: "el-icon-news",
// url: "notice/notice",
// },
// {
// path: "/gift",
// name: "gift",
// label: "",
// icon: "el-icon-present",
// url: "gift/gift",
// },
// {
// path: "/chat",
// name: "chat",
// label: " ",
// icon: "el-icon-chat-dot-round",
// url: "chat/chat",
// },
// ],
};
},
methods: {
clickMenu(item){ //
//
if(this.$route.path !== item.path && !(this.$route.path === '/statistic' && item.path === '/')){
this.$router.push(item.path)
}
}
},
computed: {
//
noChildren() {
return this.menuData.filter((item) => !item.children);
},
//
hasChildren() {
return this.menuData.filter((item) => item.children);
},
isCollapse(){
return this.$store.state.tab.isCollapse
},
menuData(){ //
//store
return JSON.parse(Cookie.get('menu')) || this.$store.state.tab.menu
}
}
};
</script>
<style>
.el-menu-vertical-demo{
width: 200px;
height: 130vh;
}
</style>
Loading…
Cancel
Save