mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
refactor(projects): 代码优化
ISSUES CLOSED: \
This commit is contained in:
@ -43,6 +43,7 @@ export const useRouteStore = defineStore('route-store', {
|
||||
cacheRoutes: []
|
||||
}),
|
||||
actions: {
|
||||
/** 重置路由的store */
|
||||
resetRouteStore() {
|
||||
this.resetRoutes();
|
||||
this.$reset();
|
||||
|
@ -16,6 +16,7 @@ export const useThemeStore = defineStore('theme-store', {
|
||||
naiveTheme(state) {
|
||||
return state.darkMode ? darkTheme : undefined;
|
||||
},
|
||||
/** 页面动画模式 */
|
||||
pageAnimateMode(state) {
|
||||
return state.page.animate ? state.page.animateMode : undefined;
|
||||
}
|
||||
@ -34,7 +35,7 @@ export const useThemeStore = defineStore('theme-store', {
|
||||
this.followSystemTheme = visible;
|
||||
},
|
||||
/** 自动跟随系统主题 */
|
||||
autoFollowSystemMode(darkMode: boolean) {
|
||||
setAutoFollowSystemMode(darkMode: boolean) {
|
||||
if (this.followSystemTheme) {
|
||||
this.darkMode = darkMode;
|
||||
}
|
||||
|
@ -1,21 +0,0 @@
|
||||
import { watch, onUnmounted } from 'vue';
|
||||
import { useBodyScroll } from '@/hooks';
|
||||
import { useAppStore } from '../modules';
|
||||
|
||||
/** 订阅app store */
|
||||
export default function subscribeAppStore() {
|
||||
const app = useAppStore();
|
||||
const { scrollBodyHandler } = useBodyScroll();
|
||||
|
||||
// 弹窗打开时禁止滚动条
|
||||
const stopHandle = watch(
|
||||
() => app.settingDrawerVisible,
|
||||
newValue => {
|
||||
scrollBodyHandler(newValue);
|
||||
}
|
||||
);
|
||||
|
||||
onUnmounted(() => {
|
||||
stopHandle();
|
||||
});
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
// import subscribeAppStore from './app';
|
||||
import subscribeThemeStore from './theme';
|
||||
|
||||
/** 订阅状态 */
|
||||
export function subscribeStore() {
|
||||
// subscribeAppStore();
|
||||
subscribeThemeStore();
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ export default function subscribeThemeStore() {
|
||||
osTheme,
|
||||
newValue => {
|
||||
const isDark = newValue === 'dark';
|
||||
theme.autoFollowSystemMode(isDark);
|
||||
theme.setAutoFollowSystemMode(isDark);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
Reference in New Issue
Block a user