perf: supplement login interface documents and add configuration parameters (#4175)
This commit is contained in:
@@ -139,7 +139,7 @@ watch(
|
||||
async (val) => {
|
||||
if (val) {
|
||||
await updateWatermark({
|
||||
content: `${preferences.app.name} 用户名: ${userStore.userInfo?.username}`,
|
||||
content: `${userStore.userInfo?.username}`,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@@ -1,50 +0,0 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
type El = HTMLElement | null | undefined;
|
||||
|
||||
export function useTabViewScroll(scrollDistance: number = 150) {
|
||||
const scrollbarEl = ref<El>(null);
|
||||
const scrollViewportEl = ref<El>(null);
|
||||
|
||||
function setScrollBarEl(el: El) {
|
||||
scrollbarEl.value = el;
|
||||
}
|
||||
|
||||
function setScrollViewEl(el: El) {
|
||||
scrollViewportEl.value = el;
|
||||
}
|
||||
|
||||
function getScrollClientWidth() {
|
||||
if (!scrollbarEl.value || !scrollViewportEl.value) return {};
|
||||
|
||||
const scrollbarWidth = scrollbarEl.value.clientWidth;
|
||||
const scrollViewWidth = scrollViewportEl.value.clientWidth;
|
||||
|
||||
return {
|
||||
scrollbarWidth,
|
||||
scrollViewWidth,
|
||||
};
|
||||
}
|
||||
|
||||
function scrollDirection(
|
||||
direction: 'left' | 'right',
|
||||
distance: number = scrollDistance,
|
||||
) {
|
||||
const { scrollbarWidth, scrollViewWidth } = getScrollClientWidth();
|
||||
|
||||
if (!scrollbarWidth || !scrollViewWidth) return;
|
||||
|
||||
if (scrollbarWidth > scrollViewWidth) return;
|
||||
|
||||
scrollViewportEl.value?.scrollBy({
|
||||
behavior: 'smooth',
|
||||
left: direction === 'left' ? -distance : +distance,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
scrollDirection,
|
||||
setScrollBarEl,
|
||||
setScrollViewEl,
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user