refactor: ♻️ 删除全屏全局组件和导航栏样式书写优化

Former-commit-id: 00c8b595147b293305d7666546ad7493a73fb810
This commit is contained in:
郝先瑞
2023-05-06 20:05:27 +08:00
parent 0d0eb35a05
commit cea9d305dc
2 changed files with 49 additions and 32 deletions

View File

@@ -1,12 +0,0 @@
<script setup lang="ts">
const { isFullscreen, toggle } = useFullscreen();
</script>
<template>
<div>
<svg-icon
:icon-class="isFullscreen ? 'exit-fullscreen' : 'fullscreen'"
@click="toggle"
/>
</div>
</template>

View File

@@ -14,11 +14,21 @@ const router = useRouter();
const { device } = storeToRefs(appStore); // 设备类型desktop-宽屏设备 || mobile-窄屏设备 const { device } = storeToRefs(appStore); // 设备类型desktop-宽屏设备 || mobile-窄屏设备
/**
* 左侧菜单栏显示/隐藏
*/
function toggleSideBar() { function toggleSideBar() {
appStore.toggleSidebar(true); appStore.toggleSidebar(true);
} }
// 注销 /**
* vueUse 全屏
*/
const { isFullscreen, toggle } = useFullscreen();
/**
* 注销
*/
function logout() { function logout() {
ElMessageBox.confirm("确定注销并退出系统吗?", "提示", { ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
@@ -52,25 +62,25 @@ function logout() {
<!-- 右侧导航设置 --> <!-- 右侧导航设置 -->
<div class="flex"> <div class="flex">
<!-- 导航栏设置(窄屏隐藏)--> <!-- 导航栏设置(窄屏隐藏)-->
<div class="setting-container" v-if="device !== 'mobile'">
<div v-if="device !== 'mobile'" class="flex items-center">
<!--全屏 --> <!--全屏 -->
<screenfull class="navbar-setting-item" /> <div class="setting-item" @click="toggle">
<svg-icon
:icon-class="isFullscreen ? 'exit-fullscreen' : 'fullscreen'"
/>
</div>
<!-- 布局大小 --> <!-- 布局大小 -->
<el-tooltip content="布局大小" effect="dark" placement="bottom"> <el-tooltip content="布局大小" effect="dark" placement="bottom">
<size-select class="navbar-setting-item" /> <size-select class="setting-item" />
</el-tooltip> </el-tooltip>
<!--语言选择--> <!--语言选择-->
<lang-select class="navbar-setting-item" /> <lang-select class="setting-item" />
</div> </div>
<!-- 用户头像 --> <!-- 用户头像 -->
<el-dropdown trigger="click"> <el-dropdown trigger="click">
<div class="flex justify-center items-center mx-2"> <div class="avatar-container">
<img <img :src="userStore.avatar + '?imageView2/1/w/80/h/80'" />
:src="userStore.avatar + '?imageView2/1/w/80/h/80'"
class="w-[40px] h-[40px] rounded-lg"
/>
<i-ep-caret-bottom class="w-3 h-3" /> <i-ep-caret-bottom class="w-3 h-3" />
</div> </div>
<template #dropdown> <template #dropdown>
@@ -106,7 +116,11 @@ function logout() {
background-color: #fff; background-color: #fff;
box-shadow: 0 0 1px #0003; box-shadow: 0 0 1px #0003;
.navbar-setting-item { .setting-container {
display: flex;
align-items: center;
.setting-item {
display: inline-block; display: inline-block;
width: 30px; width: 30px;
height: 50px; height: 50px;
@@ -120,4 +134,19 @@ function logout() {
} }
} }
} }
.avatar-container {
display: flex;
align-items: center;
justify-items: center;
margin: 0 5px;
cursor: pointer;
img {
width: 40px;
height: 40px;
border-radius: 5px;
}
}
}
</style> </style>