feat: use simpler nitro instead of nestjs to implement mock service

This commit is contained in:
vben
2024-07-20 08:31:05 +08:00
parent 9ec91ac16d
commit 9987451647
122 changed files with 2556 additions and 2967 deletions

View File

@@ -4,7 +4,7 @@ import type { Preferences } from './types';
import { markRaw, reactive, readonly, watch } from 'vue';
import { StorageManager, merge } from '@vben-core/toolkit';
import { StorageManager, isMacOs, merge } from '@vben-core/toolkit';
import {
breakpointsTailwind,
@@ -46,7 +46,7 @@ class PreferenceManager {
this.savePreferences = useDebounceFn(
(preference: Preferences) => this._savePreferences(preference),
200,
100,
);
}
@@ -81,6 +81,11 @@ class PreferenceManager {
}
}
private initPlatform() {
const dom = document.documentElement;
dom.dataset.platform = isMacOs() ? 'macOs' : 'window';
}
/**
* 从缓存中加载偏好设置。如果缓存中没有找到对应的偏好设置,则返回默认偏好设置。
*/
@@ -187,6 +192,8 @@ class PreferenceManager {
this.updatePreferences(mergedPreference);
this.setupWatcher();
this.initPlatform();
// 标记为已初始化
this.isInitialized = true;
}