feat: add docker shell
This commit is contained in:
@@ -2,7 +2,7 @@ import type { Preference } from '@vben-core/typings';
|
||||
|
||||
class PreferenceCache {
|
||||
cachePrefix: string;
|
||||
constructor(cachePrefix: string = 'vben-admin') {
|
||||
constructor(cachePrefix: string) {
|
||||
this.cachePrefix = cachePrefix;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ class PreferenceCache {
|
||||
* 获取偏好设置的缓存键
|
||||
*/
|
||||
getCacheKey(name: string = 'preference') {
|
||||
const env = import.meta.env.DEV ? 'dev' : 'prod';
|
||||
return `__${this.cachePrefix}-${name}-${env}__`;
|
||||
return `__${this.cachePrefix}-${name}__`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -34,8 +34,9 @@ const defaultPreference: Preference = {
|
||||
pageTransition: 'fade-slide',
|
||||
pageTransitionEnable: true,
|
||||
semiDarkMenu: true,
|
||||
showPreference: true,
|
||||
sideCollapse: false,
|
||||
sideCollapseShowTitle: false,
|
||||
sideCollapseShowTitle: true,
|
||||
sideExpandOnHover: true,
|
||||
sideExtraCollapse: true,
|
||||
sideVisible: true,
|
||||
|
@@ -4,22 +4,24 @@ import { PreferenceCache } from './cache';
|
||||
import { overridesPreference } from './preference';
|
||||
|
||||
interface SetupPreferenceOptions {
|
||||
/**
|
||||
* @zh_CN 环境
|
||||
*/
|
||||
env: string;
|
||||
/**
|
||||
* @zh_CN 应用名,由于 @vben/preference 是公用的,后续可能有多个app,为了防止多个app缓存冲突,可在这里配置应用名
|
||||
* 应用名将被用于持久化的前缀
|
||||
*/
|
||||
cachePrefix?: string;
|
||||
namespace: string;
|
||||
/**
|
||||
* @zh_CN app自行覆盖偏好设置
|
||||
*/
|
||||
overrides?: DeepPartial<Preference>;
|
||||
}
|
||||
|
||||
async function setupPreference(options: SetupPreferenceOptions = {}) {
|
||||
const { cachePrefix = 'vben-admin-pro', overrides = {} } = options;
|
||||
|
||||
const cache = new PreferenceCache(cachePrefix);
|
||||
|
||||
async function setupPreference(options: SetupPreferenceOptions) {
|
||||
const { env, namespace, overrides = {} } = options;
|
||||
const cache = new PreferenceCache(`${namespace}-${env}`);
|
||||
overridesPreference(overrides, cache);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user