1.Center页面
2.LeftMenu代码
<template>
<div>
<el-col :span="3">
<el-menu
:default-active="this.$route.path"
router
mode="vertical"
class="el-menu-vertical-demo"
@open="handleOpen"
@close="handleClose"
background-color="#545c64"
text-color="#fff"
active-text-color="#ffd04b"
>
<el-menu-item v-for="(item, index) in mineList" :key="index" :index="item.path">
<template>
<i :class="item.icon"></i>
<span slot="title">{{item.name}}</span>
</template>
</el-menu-item>
</el-menu>
</el-col>
<router-view class="menu-right" />
</div>
</template>
<script>
export default {
data() {
return {
mineList: [
{
name: "我的订单",
icon: "el-icon-date",
path: "/center/order"
},
{
name: "我的点评",
icon: "el-icon-edit-outline",
path: "/center/comment"
},
{
name: "个人资料",
icon: "el-icon-tickets",
path: "/center/personal"
}
]
};
},
methods: {
handleOpen(key, keyPath) {
console.log(key, keyPath);
},
handleClose(key, keyPath) {
console.log(key, keyPath);
}
}
};
</script>
<style scoped>
.menu-right {
margin-left: 150px;
}
</style>
3.订单代码
<template>
<div>我的订单列表</div>
</template>
<script>
export default {
name: "MyOrder"
};
</script>
<style>
</style>
4.路由配置
5.效果展示