Skip to content

Commit 8252d11

Browse files
committed
fix: fix some known problems
1 parent 692225c commit 8252d11

File tree

6 files changed

+36
-26
lines changed

6 files changed

+36
-26
lines changed

packages/@core/forward/preferences/src/preferences.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class PreferenceManager {
7272
private handleUpdates(updates: DeepPartial<Preferences>) {
7373
const themeUpdates = updates.theme || {};
7474
const appUpdates = updates.app || {};
75-
7675
if (themeUpdates && Object.keys(themeUpdates).length > 0) {
7776
this.updateTheme(this.state);
7877
}
@@ -162,15 +161,14 @@ class PreferenceManager {
162161
private updateColorMode(preference: Preferences) {
163162
if (preference.app) {
164163
const { colorGrayMode, colorWeakMode } = preference.app;
165-
const body = document.body;
166164
const COLOR_WEAK = 'invert-mode';
167165
const COLOR_GRAY = 'grayscale-mode';
168166
colorWeakMode
169-
? body.classList.add(COLOR_WEAK)
170-
: body.classList.remove(COLOR_WEAK);
167+
? document.documentElement.classList.add(COLOR_WEAK)
168+
: document.documentElement.classList.remove(COLOR_WEAK);
171169
colorGrayMode
172-
? body.classList.add(COLOR_GRAY)
173-
: body.classList.remove(COLOR_GRAY);
170+
? document.documentElement.classList.add(COLOR_GRAY)
171+
: document.documentElement.classList.remove(COLOR_GRAY);
174172
}
175173
}
176174

@@ -341,13 +339,14 @@ class PreferenceManager {
341339
[STORAGE_KEY, STORAGE_KEY_THEME, STORAGE_KEY_LOCALE].forEach((key) => {
342340
this.cache?.removeItem(key);
343341
});
342+
this.updatePreferences(this.state);
344343
}
345344

346345
/**
347346
* 更新偏好设置
348347
* @param updates - 要更新的偏好设置
349348
*/
350-
public updatePreferences(updates: DeepPartial<Preferences>) {
349+
public async updatePreferences(updates: DeepPartial<Preferences>) {
351350
const mergedState = merge({}, updates, markRaw(this.state));
352351

353352
Object.assign(this.state, mergedState);

packages/@core/shared/design/src/scss/common/base.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ html {
2121
border-width: 0;
2222
}
2323

24-
body.invert-mode {
24+
html.invert-mode {
2525
@apply invert;
2626
}
2727

28-
body.grayscale-mode {
28+
html.grayscale-mode {
2929
@apply grayscale;
3030
}
3131

packages/@core/ui-kit/layout-ui/src/components/layout-sidebar.vue

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const props = withDefaults(defineProps<Props>(), {
9292
domVisible: true,
9393
extraWidth: 180,
9494
fixedExtra: false,
95-
isSideMixed: false,
95+
isSidebarMixed: false,
9696
mixedWidth: 80,
9797
paddingTop: 60,
9898
show: true,
@@ -118,13 +118,13 @@ const hiddenSideStyle = computed((): CSSProperties => {
118118
});
119119
120120
const style = computed((): CSSProperties => {
121-
const { isSideMixed, paddingTop, zIndex } = props;
121+
const { isSidebarMixed, paddingTop, zIndex } = props;
122122
123123
return {
124124
...calcMenuWidthStyle(false),
125125
paddingTop: `${paddingTop}px`,
126126
zIndex,
127-
...(isSideMixed && extraVisible.value ? { transition: 'none' } : {}),
127+
...(isSidebarMixed && extraVisible.value ? { transition: 'none' } : {}),
128128
};
129129
});
130130
@@ -147,8 +147,8 @@ const extraTitleStyle = computed((): CSSProperties => {
147147
});
148148
149149
const contentWidthStyle = computed((): CSSProperties => {
150-
const { collapseWidth, fixedExtra, isSideMixed, mixedWidth } = props;
151-
if (isSideMixed && fixedExtra) {
150+
const { collapseWidth, fixedExtra, isSidebarMixed, mixedWidth } = props;
151+
if (isSidebarMixed && fixedExtra) {
152152
return { width: `${collapse.value ? collapseWidth : mixedWidth}px` };
153153
}
154154
return {};
@@ -165,10 +165,10 @@ const contentStyle = computed((): CSSProperties => {
165165
});
166166
167167
const headerStyle = computed((): CSSProperties => {
168-
const { headerHeight, isSideMixed } = props;
168+
const { headerHeight, isSidebarMixed } = props;
169169
170170
return {
171-
...(isSideMixed ? { display: 'flex', justifyContent: 'center' } : {}),
171+
...(isSidebarMixed ? { display: 'flex', justifyContent: 'center' } : {}),
172172
height: `${headerHeight}px`,
173173
...contentWidthStyle.value,
174174
};
@@ -195,10 +195,16 @@ watchEffect(() => {
195195
});
196196
197197
function calcMenuWidthStyle(isHiddenDom: boolean): CSSProperties {
198-
const { backgroundColor, extraWidth, fixedExtra, isSideMixed, show, width } =
199-
props;
200-
201-
let widthValue = `${width + (isSideMixed && fixedExtra && extraVisible.value ? extraWidth : 0)}px`;
198+
const {
199+
backgroundColor,
200+
extraWidth,
201+
fixedExtra,
202+
isSidebarMixed,
203+
show,
204+
width,
205+
} = props;
206+
207+
let widthValue = `${width + (isSidebarMixed && fixedExtra && extraVisible.value ? extraWidth : 0)}px`;
202208
203209
const { collapseWidth } = props;
204210

packages/@core/ui-kit/layout-ui/src/vben-layout.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ const props = withDefaults(defineProps<Props>(), {
2727
contentPaddingRight: 0,
2828
contentPaddingTop: 0,
2929
footerEnable: false,
30-
// footerBackgroundColor: '#fff',
3130
footerFixed: true,
3231
footerHeight: 32,
33-
// headerBackgroundColor: 'hsl(var(--background))',
3432
headerHeight: 50,
3533
headerHeightOffset: 10,
3634
headerHidden: false,
@@ -39,7 +37,6 @@ const props = withDefaults(defineProps<Props>(), {
3937
headerVisible: true,
4038
isMobile: false,
4139
layout: 'sidebar-nav',
42-
// sideCollapse: false,
4340
sideCollapseWidth: 60,
4441
sidebarCollapseShowTitle: false,
4542
sidebarHidden: false,
@@ -48,7 +45,6 @@ const props = withDefaults(defineProps<Props>(), {
4845
sidebarTheme: 'dark',
4946
sidebarWidth: 180,
5047
tabbarEnable: true,
51-
// tabsBackgroundColor: 'hsl(var(--background))',
5248
tabsHeight: 36,
5349
zIndex: 200,
5450
});
@@ -134,6 +130,7 @@ const headerWrapperHeight = computed(() => {
134130
const getSideCollapseWidth = computed(() => {
135131
const { sideCollapseWidth, sidebarCollapseShowTitle, sidebarMixedWidth } =
136132
props;
133+
137134
return sidebarCollapseShowTitle || isSidebarMixedNav.value
138135
? sidebarMixedWidth
139136
: sideCollapseWidth;
@@ -187,6 +184,7 @@ const getSidebarWidth = computed(() => {
187184
*/
188185
const getExtraWidth = computed(() => {
189186
const { sidebarWidth } = props;
187+
190188
return sidebarExtraCollapse.value ? getSideCollapseWidth.value : sidebarWidth;
191189
});
192190

packages/@core/ui-kit/menu-ui/src/components/normal-menu/normal-menu.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function handleMouseenter(menu: MenuRecordRaw) {
5252
@mouseenter="handleMouseenter(menu)"
5353
>
5454
<VbenIcon :class="e('icon')" :icon="menu.icon" fallback />
55-
<span :class="e('name')"> {{ menu.name }}</span>
55+
<span :class="e('name')" class="truncate"> {{ menu.name }}</span>
5656
</li>
5757
</template>
5858
</ul>

packages/business/layouts/src/basic/layout.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ const theme = computed(() => {
4141
});
4242
4343
const logoClass = computed(() => {
44+
let cls = '';
4445
const { collapsed, collapsedShowTitle } = preferences.sidebar;
45-
return collapsedShowTitle && collapsed && !isMixedNav.value ? 'mx-auto' : '';
46+
if (collapsedShowTitle && collapsed && !isMixedNav.value) {
47+
cls += ' mx-auto';
48+
}
49+
if (isSideMixedNav.value) {
50+
cls += ' flex-center';
51+
}
52+
return cls;
4653
});
4754
4855
const isMenuRounded = computed(() => {

0 commit comments

Comments
 (0)