mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 06:40:51 +08:00
fix: locale switching logic correction (#5344)
* 修复语言切换后的数据更新逻辑 * 表单默认按钮的content属性可提供computed类型的值
This commit is contained in:
@@ -6,7 +6,7 @@ import type { MenuRecordRaw } from '@vben/types';
|
||||
import { computed, useSlots, watch } from 'vue';
|
||||
|
||||
import { useRefresh } from '@vben/hooks';
|
||||
import { $t } from '@vben/locales';
|
||||
import { $t, i18n } from '@vben/locales';
|
||||
import {
|
||||
preferences,
|
||||
updatePreferences,
|
||||
@@ -163,7 +163,8 @@ watch(
|
||||
);
|
||||
|
||||
// 语言更新后,刷新页面
|
||||
watch(() => preferences.app.locale, refresh, { flush: 'post' });
|
||||
// i18n.global.locale会在preference.app.locale变更之后才会更新,因此watchpreference.app.locale是不合适的,刷新页面时可能语言配置尚未完全加载完成
|
||||
watch(i18n.global.locale, refresh, { flush: 'post' });
|
||||
|
||||
const slots: SetupContext['slots'] = useSlots();
|
||||
const headerSlots = computed(() => {
|
||||
|
Reference in New Issue
Block a user