首页
找靠谱产品
找解决方案
找靠谱公司
找案例
找对的人
专家智库
悬赏任务
SAAS
ToB门户
了解全球最新的ToB事件
论坛
潜水/灌水快乐,沉淀知识,认识更多同行。
ToB圈子
加入IT圈,遇到更多同好之人。
微博
Follow
记录
Doing
博客
Blog
文库
业界最专业的IT文库,上传资料也可以赚钱
下载
分享
Share
排行榜
Ranklist
相册
Album
应用中心
qidao123.com ToB IT社区-企服评测·应用市场
»
论坛
›
大数据
›
数据仓库与分析
›
侧边菜单的睁开和折叠
返回列表
发新帖
侧边菜单的睁开和折叠
[复制链接]
发表于 2026-1-16 04:20:58
|
显示全部楼层
|
阅读模式
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要
登录
才可以下载或查看,没有账号?
立即注册
×
环境预备:Vue3+Element-UI Plus
<script setup>
import {ref} from "vue";
// 是否折叠菜单,默认折叠
const isCollapse = ref(true)
// 退出登录
function logout() {
alert('退出')
}
// 个人中心
function profile() {
alert('个人中心')
}
</script>
<template>
<el-container>
<el-aside>
<el-scrollbar>
<el-menu
:collapse="isCollapse"
active-text-color="#ffd04b"
background-color="#545c64"
class="el-menu-vertical-demo"
default-active="2"
text-color="#fff"
>
<el-sub-menu index="1">
<template #title>
<el-icon>
<location/>
</el-icon>
<span>Navigator One</span>
</template>
<el-menu-item-group title="Group One">
<el-menu-item index="1-1">item one</el-menu-item>
<el-menu-item index="1-2">item two</el-menu-item>
</el-menu-item-group>
<el-menu-item-group title="Group Two">
<el-menu-item index="1-3">item three</el-menu-item>
</el-menu-item-group>
<el-sub-menu index="1-4">
<template #title>item four</template>
<el-menu-item index="1-4-1">item one</el-menu-item>
</el-sub-menu>
</el-sub-menu>
<el-menu-item index="2">
<el-icon>
<Menu/>
</el-icon>
<span>Navigator Two</span>
</el-menu-item>
<el-menu-item index="3" disabled>
<el-icon>
<document/>
</el-icon>
<span>Navigator Three</span>
</el-menu-item>
<el-menu-item index="4">
<el-icon>
<setting/>
</el-icon>
<span>Navigator Four</span>
</el-menu-item>
</el-menu>
</el-scrollbar>
</el-aside>
<el-container style="height: 100vh;">
<el-header>
<el-row align="middle" justify="space-between" style="height: 100%">
<el-col :span="1" style="cursor: pointer">
<el-icon v-show="isCollapse" @click="isCollapse=false">
<Expand/>
</el-icon>
<el-icon v-show="!isCollapse" @click="isCollapse=true">
<Fold/>
</el-icon>
</el-col>
<el-col :span="1">
<el-dropdown>
<el-image class="avatar" src="/public/vite.svg"></el-image>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="profile">个人信息</el-dropdown-item>
<el-dropdown-item @click="logout" divided>退出</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</el-col>
</el-row>
</el-header>
<el-main>
</el-main>
</el-container>
</el-container>
</template>
<style scoped lang="scss">
.el-container {
.el-aside {
height: 100vh;
width: auto;
:deep(.el-scrollbar__view ){
height: 100%;
.el-menu {
height: 100%;
width: 100%;
}
}
}
.el-container {
.el-header {
background-color: #ffffff;
.avatar {
border-radius: 50%;
cursor: pointer;
}
}
.el-main {
background-color: #efefef;
}
}
}
</style>
复制
代码
回复
使用道具
举报
返回列表
浏览过的版块
DevOps与敏捷开发
物联网
Oracle
SQL-Server
人工智能
分布式数据库
Mysql
Java
SAAS
备份
灌篮少年
+ 我要发帖
登录后关闭弹窗
登录参与点评抽奖 加入IT实名职场社区
去登录
微信订阅号
微信服务号
微信客服(加群)
H5
小程序
快速回复
返回顶部
返回列表