fix(projects): 修复vertical-mix布局、重构初始化的loading

This commit is contained in:
Soybean
2022-01-18 01:17:09 +08:00
parent b2a4ddf5e3
commit 579e07400e
32 changed files with 563 additions and 737 deletions

View File

@@ -1,4 +1,3 @@
export * from './system';
export * from './router';
export * from './theme';
export * from './layout';

View File

@@ -1,37 +0,0 @@
import { watch, onUnmounted } from 'vue';
import { useOsTheme } from 'naive-ui';
import { useElementSize } from '@vueuse/core';
import { useThemeStore } from '@/store';
export function useTheme() {
const osTheme = useOsTheme();
const theme = useThemeStore();
const { width } = useElementSize(document.documentElement);
/** 监听操作系统主题模式 */
const stopHandle = watch(
osTheme,
newValue => {
const isDark = newValue === 'dark';
theme.setDarkMode(isDark);
},
{ immediate: true }
);
/**
* 禁用横向滚动
* @description 页面切换时,过渡动画会产生水平方向的滚动条, 小于最小宽度时,不禁止
*/
const anotherStopHandle = watch(width, newValue => {
if (newValue < theme.layout.minWidth) {
document.documentElement.style.overflowX = 'auto';
} else {
document.documentElement.style.overflowX = 'hidden';
}
});
onUnmounted(() => {
stopHandle();
anotherStopHandle();
});
}