perf: improve the shadow in the upper and lower areas when the scrolling area is scrolling,close #20, close #26
parent
e441d14fa2
commit
91058c3ed9
|
@ -118,9 +118,10 @@ const hiddenSideStyle = computed((): CSSProperties => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const style = computed((): CSSProperties => {
|
const style = computed((): CSSProperties => {
|
||||||
const { isSidebarMixed, paddingTop, zIndex } = props;
|
const { isSidebarMixed, paddingTop, theme, zIndex } = props;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
'--scroll-shadow': theme === 'dark' ? 'var(--menu-dark)' : 'var(--menu)',
|
||||||
...calcMenuWidthStyle(false),
|
...calcMenuWidthStyle(false),
|
||||||
paddingTop: `${paddingTop}px`,
|
paddingTop: `${paddingTop}px`,
|
||||||
zIndex,
|
zIndex,
|
||||||
|
|
|
@ -28,18 +28,40 @@ function handleScroll(event: Event) {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ScrollArea
|
<ScrollArea
|
||||||
:class="[
|
:class="[cn(props.class)]"
|
||||||
cn(props.class),
|
|
||||||
{
|
|
||||||
// 'shadow-none': isAtTop && isAtBottom,
|
|
||||||
// shadow: !isAtTop || !isAtBottom,
|
|
||||||
// 'dark:shadow-white/20': !isAtTop || !isAtBottom,
|
|
||||||
// 'shadow-inner': !isAtBottom,
|
|
||||||
// 'dark:shadow-inner-white/20': !isAtBottom,
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
:on-scroll="handleScroll"
|
:on-scroll="handleScroll"
|
||||||
|
class="relative"
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
:class="{
|
||||||
|
'opacity-100': !isAtTop,
|
||||||
|
}"
|
||||||
|
class="scrollbar-top-shadow pointer-events-none absolute top-0 z-10 h-16 w-full opacity-0 transition-opacity duration-1000 ease-in-out will-change-[opacity]"
|
||||||
|
></div>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
<div
|
||||||
|
:class="{
|
||||||
|
'opacity-100': !isAtTop && !isAtBottom,
|
||||||
|
}"
|
||||||
|
class="scrollbar-bottom-shadow pointer-events-none absolute bottom-0 z-10 h-16 w-full opacity-0 transition-opacity duration-1000 ease-in-out will-change-[opacity]"
|
||||||
|
></div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.scrollbar-top-shadow {
|
||||||
|
background: linear-gradient(
|
||||||
|
to bottom,
|
||||||
|
hsl(var(--scroll-shadow, var(--background))),
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scrollbar-bottom-shadow {
|
||||||
|
background: linear-gradient(
|
||||||
|
to top,
|
||||||
|
hsl(var(--scroll-shadow, var(--background))),
|
||||||
|
transparent
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -17,7 +17,7 @@ defineOptions({
|
||||||
});
|
});
|
||||||
|
|
||||||
const modelValue = defineModel<string>({ default: 'auto' });
|
const modelValue = defineModel<string>({ default: 'auto' });
|
||||||
const appSemiDarkMenu = defineModel<boolean>('appSemiDarkMenu', {
|
const themeSemiDarkMenu = defineModel<boolean>('themeSemiDarkMenu', {
|
||||||
default: true,
|
default: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ function nameView(name: string) {
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<SwitchItem
|
<SwitchItem
|
||||||
v-model="appSemiDarkMenu"
|
v-model="themeSemiDarkMenu"
|
||||||
:disabled="modelValue !== 'light'"
|
:disabled="modelValue !== 'light'"
|
||||||
class="mt-6"
|
class="mt-6"
|
||||||
>
|
>
|
||||||
|
|
|
@ -61,7 +61,6 @@ const appDynamicTitle = defineModel<boolean>('appDynamicTitle');
|
||||||
const appLayout = defineModel<LayoutType>('appLayout');
|
const appLayout = defineModel<LayoutType>('appLayout');
|
||||||
const appColorGrayMode = defineModel<boolean>('appColorGrayMode');
|
const appColorGrayMode = defineModel<boolean>('appColorGrayMode');
|
||||||
const appColorWeakMode = defineModel<boolean>('appColorWeakMode');
|
const appColorWeakMode = defineModel<boolean>('appColorWeakMode');
|
||||||
const appSemiDarkMenu = defineModel<boolean>('appSemiDarkMenu');
|
|
||||||
const appContentCompact = defineModel<ContentCompactType>('appContentCompact');
|
const appContentCompact = defineModel<ContentCompactType>('appContentCompact');
|
||||||
|
|
||||||
const transitionProgress = defineModel<boolean>('transitionProgress');
|
const transitionProgress = defineModel<boolean>('transitionProgress');
|
||||||
|
@ -73,6 +72,7 @@ const themeColorPrimary = defineModel<string>('themeColorPrimary');
|
||||||
const themeBuiltinType = defineModel<BuiltinThemeType>('themeBuiltinType');
|
const themeBuiltinType = defineModel<BuiltinThemeType>('themeBuiltinType');
|
||||||
const themeMode = defineModel<ThemeModeType>('themeMode');
|
const themeMode = defineModel<ThemeModeType>('themeMode');
|
||||||
const themeRadius = defineModel<string>('themeRadius');
|
const themeRadius = defineModel<string>('themeRadius');
|
||||||
|
const themeSemiDarkMenu = defineModel<boolean>('themeSemiDarkMenu');
|
||||||
|
|
||||||
const sidebarEnable = defineModel<boolean>('sidebarEnable');
|
const sidebarEnable = defineModel<boolean>('sidebarEnable');
|
||||||
const sidebarWidth = defineModel<number>('sidebarWidth');
|
const sidebarWidth = defineModel<number>('sidebarWidth');
|
||||||
|
@ -269,7 +269,7 @@ async function handleReset() {
|
||||||
<Block :title="$t('preferences.theme.title')">
|
<Block :title="$t('preferences.theme.title')">
|
||||||
<Theme
|
<Theme
|
||||||
v-model="themeMode"
|
v-model="themeMode"
|
||||||
v-model:app-semi-dark-menu="appSemiDarkMenu"
|
v-model:theme-semi-dark-menu="themeSemiDarkMenu"
|
||||||
/>
|
/>
|
||||||
</Block>
|
</Block>
|
||||||
<!-- <Block :title="$t('preferences.theme-color')">
|
<!-- <Block :title="$t('preferences.theme-color')">
|
||||||
|
|
Loading…
Reference in New Issue