feat(projects): 添加常用组件、composables函数

This commit is contained in:
Soybean
2021-12-12 17:28:39 +08:00
parent e755caabf2
commit 230a50a4cf
87 changed files with 5424 additions and 2071 deletions

View File

@@ -57,3 +57,30 @@ export function useDarkMode() {
naiveTheme
};
}
/** 更改html样式 */
export function useHtmlStyle() {
const HIDE_SCROLL_CLASS = 'overflow-hidden';
function getHtmlElement() {
return document.querySelector('html');
}
function handleHideScroll() {
const html = getHtmlElement();
if (html) {
html.classList.add(HIDE_SCROLL_CLASS);
}
}
function handleAutoScroll() {
const html = getHtmlElement();
if (html) {
html.classList.remove(HIDE_SCROLL_CLASS);
}
}
return {
handleHideScroll,
handleAutoScroll
};
}