feat: main窗口滚动完善中

This commit is contained in:
wf 2024-09-03 18:44:15 +08:00
parent 6987467e98
commit f8dff50951
7 changed files with 106 additions and 32 deletions

View File

@ -0,0 +1,63 @@
<template>
<a-watermark :content="watermark" v-bind="watermarkConfig">
<a-layout-content class="layout-main-content">
<Tabs v-if="isTabs" />
<a-scrollbar style="height: 100%; overflow: auto" :outer-class="isTabs ? 'scrollbar' : 'scrollbar-no-tabs'">
<div>
<router-view v-slot="{ Component, route }">
<MainTransition>
<keep-alive :include="cacheRoutes">
<component :is="Component" :key="route.name" v-if="refreshPage" />
</keep-alive>
</MainTransition>
</router-view>
</div>
</a-scrollbar>
</a-layout-content>
</a-watermark>
</template>
<script setup lang="ts">
import Tabs from "@/layout/components/Tabs/index.vue";
import { storeToRefs } from "pinia";
import { useThemeConfig } from "@/store/modules/theme-config";
import { useRoutesListStore } from "@/store/modules/route-list";
const themeStore = useThemeConfig();
let { refreshPage, isTabs, watermark, watermarkStyle, watermarkRotate, watermarkGap } = storeToRefs(themeStore);
const routerStore = useRoutesListStore();
const { cacheRoutes } = storeToRefs(routerStore);
//
const watermarkConfig = computed(() => {
return {
font: watermarkStyle.value,
rotate: watermarkRotate.value,
gap: watermarkGap.value
};
});
watch(watermarkConfig, newv => {
console.log(newv);
});
</script>
<style lang="scss" scoped>
.layout-main-content {
height: 100%;
}
.scrollbar {
height: calc(100% - 40px); // tabs
background: $color-fill-1; //
}
.scrollbar-no-tabs {
height: 100%;
background: $color-fill-1; //
}
//
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
}
</style>

View File

@ -2,8 +2,6 @@
<a-watermark :content="watermark" v-bind="watermarkConfig"> <a-watermark :content="watermark" v-bind="watermarkConfig">
<a-layout-content class="layout-main-content"> <a-layout-content class="layout-main-content">
<Tabs v-if="isTabs" /> <Tabs v-if="isTabs" />
<a-scrollbar style="height: 100%; overflow: auto" :outer-class="isTabs ? 'scrollbar' : 'scrollbar-no-tabs'">
<div>
<router-view v-slot="{ Component, route }"> <router-view v-slot="{ Component, route }">
<MainTransition> <MainTransition>
<keep-alive :include="cacheRoutes"> <keep-alive :include="cacheRoutes">
@ -11,8 +9,6 @@
</keep-alive> </keep-alive>
</MainTransition> </MainTransition>
</router-view> </router-view>
</div>
</a-scrollbar>
</a-layout-content> </a-layout-content>
</a-watermark> </a-watermark>
</template> </template>
@ -44,20 +40,7 @@ watch(watermarkConfig, newv => {
<style lang="scss" scoped> <style lang="scss" scoped>
.layout-main-content { .layout-main-content {
height: 100%; height: 100%;
} display: flex;
flex-direction: column;
.scrollbar {
height: calc(100% - 40px); // tabs
background: $color-fill-1; //
}
.scrollbar-no-tabs {
height: 100%;
background: $color-fill-1; //
}
//
:deep(.arco-scrollbar-thumb-direction-vertical .arco-scrollbar-thumb-bar) {
width: 4px;
margin-left: 8px;
} }
</style> </style>

View File

@ -99,13 +99,12 @@ export const treeSort = (tree: Menu.MenuOptions[]) => {
}); });
// 深层递归 // 深层递归
let sortAfter = tree.map((item: any) => { return tree.map((item: any) => {
if (item?.children?.length > 0) { if (item?.children?.length > 0) {
item.children = treeSort(item.children); item.children = treeSort(item.children);
} }
return item; return item;
}); });
return sortAfter;
}; };
/** /**

View File

@ -0,0 +1,28 @@
// 设置滚动条的样式
::-webkit-scrollbar {
width: 6px;
}
// 基于 WebKit 内核的浏览器
// 设置滚动条的样式圆角背景颜色
::-webkit-scrollbar-thumb {
width: 6px;
border-radius: 6px;
background-color: $color-border-2;
}
// 设置滚动条hover样式圆角背景颜色
::-webkit-scrollbar-thumb:hover {
width: 6px;
background-color: $color-border-3;
}
// 设置IE/Edge浏览器滚动条的样式与webkit内核浏览器样式相同
::-ms-scrollbar-thumb {
width: 6px;
border-radius: 6px;
background-color: $color-border-2;
}
::-ms-scrollbar-thumb:hover {
width: 6px;
background-color: $color-border-3;
}

View File

@ -3,8 +3,11 @@
// 有背景色的页面 // 有背景色的页面
.snow-page { .snow-page {
// margin padding 边距一致是为了保持视觉上的内外统一 // margin padding 边距一致是为了保持视觉上的内外统一
margin: $padding; // margin: $padding;
box-sizing: border-box;
flex: 1;
padding: $padding; padding: $padding;
overflow-y: auto;
background: $color-bg-1; background: $color-bg-1;
} }

View File

@ -1,6 +1,7 @@
@import "@/style/global-theme.scss"; @import "@/style/global-theme.scss";
@import "@/style/global-transition.scss"; @import "@/style/global-transition.scss";
@import "@/style/global-style.scss"; @import "@/style/global-style.scss";
@import "@/style/global-scrollbar.scss";
@import "@/style/loading-page.scss"; @import "@/style/loading-page.scss";
@import "@/style/card-animation.scss"; @import "@/style/card-animation.scss";
@import "@/style/media/media.scss"; @import "@/style/media/media.scss";

View File

@ -11,12 +11,9 @@
<a-descriptions :column="2" bordered> <a-descriptions :column="2" bordered>
<a-descriptions-item v-for="item of projectInfo" :key="item.label" :label="item.label"> <a-descriptions-item v-for="item of projectInfo" :key="item.label" :label="item.label">
<a-link :href="item.value" v-if="item.link">{{ item.label }}</a-link> <a-link :href="item.value" v-if="item.link">{{ item.label }}</a-link>
<!-- <a-tag :default-checked="true">Lark</a-tag> -->
<span v-else>{{ item.value }}</span> <span v-else>{{ item.value }}</span>
</a-descriptions-item> </a-descriptions-item>
</a-descriptions> </a-descriptions>
<!-- <a-descriptions :data="projectInfo" bordered :column="2" /> -->
</a-card> </a-card>
<a-card class="margin-top" title="生产环境依赖"> <a-card class="margin-top" title="生产环境依赖">
<a-descriptions :data="dependencies" bordered :column="2" /> <a-descriptions :data="dependencies" bordered :column="2" />