feat: 优化滚动条样式 (#84)

This commit is contained in:
CHENZL 2023-06-05 11:19:27 +08:00 committed by GitHub
parent 4c08e5f190
commit 155c3e247b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 7 deletions

View File

@ -13,17 +13,21 @@ const key = computed(() => {
<template>
<section class="app-main">
<router-view v-slot="{ Component }">
<transition name="el-fade-in" mode="out-in">
<keep-alive :include="tagsViewStore.cachedViews">
<component :is="Component" :key="key" />
</keep-alive>
</transition>
</router-view>
<div class="app-scrollbar">
<router-view v-slot="{ Component }">
<transition name="el-fade-in" mode="out-in">
<keep-alive :include="tagsViewStore.cachedViews">
<component :is="Component" :key="key" />
</keep-alive>
</transition>
</router-view>
</div>
</section>
</template>
<style lang="scss" scoped>
@import "@/styles/mixins.scss";
.app-main {
min-height: calc(100vh - var(--v3-navigationbar-height));
width: 100%;
@ -32,6 +36,12 @@ const key = computed(() => {
background-color: var(--v3-body-bg-color);
}
.app-scrollbar {
height: 100%;
overflow: auto;
@include scrollbar;
}
.fixed-header + .app-main {
padding-top: var(--v3-navigationbar-height);
height: 100vh;

View File

@ -8,6 +8,8 @@
@import "./vxe-table.scss";
// 注册多主题
@import "./theme/register.scss";
// mixin
@import "./mixins.scss";
// 业务页面几乎都应该在根元素上挂载 class="app-container"以保持页面美观
.app-container {
@ -25,6 +27,7 @@ body {
-webkit-font-smoothing: antialiased;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial,
sans-serif;
@include scrollbar();
}
#app {

View File

@ -5,3 +5,25 @@
clear: both;
}
}
@mixin scrollbar {
&::-webkit-scrollbar {
width: 8px;
height: 8px; // 也要兼容 height 样式
background: transparent;
}
&::-webkit-scrollbar-thumb {
border-radius: 16px;
background-color: #d6d7d9;
}
&::-webkit-scrollbar-thumb:hover {
background-color: #c0c3c5;
}
&::-webkit-scrollbar-thumb:active {
background-color: #acafb2;
}
&::-webkit-scrollbar-button {
background: transparent;
height: 10px;
}
}