mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-23 09:40:25 +08:00
fix: locale switching logic correction (#5344)
Some checks are pending
CI / Test (ubuntu-latest) (push) Waiting to run
CI / Test (windows-latest) (push) Waiting to run
CI / Lint (ubuntu-latest) (push) Waiting to run
CI / Lint (windows-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / CI OK (push) Blocked by required conditions
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Deploy Website on push / Deploy Push Playground Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Docs Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Antd Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Element Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Naive Ftp (push) Waiting to run
Release Drafter / update_release_draft (push) Waiting to run
Some checks are pending
CI / Test (ubuntu-latest) (push) Waiting to run
CI / Test (windows-latest) (push) Waiting to run
CI / Lint (ubuntu-latest) (push) Waiting to run
CI / Lint (windows-latest) (push) Waiting to run
CI / Check (ubuntu-latest) (push) Waiting to run
CI / Check (windows-latest) (push) Waiting to run
CI / CI OK (push) Blocked by required conditions
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
Deploy Website on push / Deploy Push Playground Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Docs Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Antd Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Element Ftp (push) Waiting to run
Deploy Website on push / Deploy Push Naive Ftp (push) Waiting to run
Release Drafter / update_release_draft (push) Waiting to run
* 修复语言切换后的数据更新逻辑 * 表单默认按钮的content属性可提供computed类型的值
This commit is contained in:
parent
7606b86854
commit
624beb6fa0
@ -4,7 +4,7 @@ import type { ZodTypeAny } from 'zod';
|
|||||||
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
|
import type { Component, HtmlHTMLAttributes, Ref } from 'vue';
|
||||||
|
|
||||||
import type { VbenButtonProps } from '@vben-core/shadcn-ui';
|
import type { VbenButtonProps } from '@vben-core/shadcn-ui';
|
||||||
import type { ClassType, Nullable } from '@vben-core/typings';
|
import type { ClassType, MaybeComputedRef, Nullable } from '@vben-core/typings';
|
||||||
|
|
||||||
import type { FormApi } from './form-api';
|
import type { FormApi } from './form-api';
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ export interface FormRenderProps<
|
|||||||
|
|
||||||
export interface ActionButtonOptions extends VbenButtonProps {
|
export interface ActionButtonOptions extends VbenButtonProps {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
content?: string;
|
content?: MaybeComputedRef<string>;
|
||||||
show?: boolean;
|
show?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import type { MenuRecordRaw } from '@vben/types';
|
|||||||
import { computed, useSlots, watch } from 'vue';
|
import { computed, useSlots, watch } from 'vue';
|
||||||
|
|
||||||
import { useRefresh } from '@vben/hooks';
|
import { useRefresh } from '@vben/hooks';
|
||||||
import { $t } from '@vben/locales';
|
import { $t, i18n } from '@vben/locales';
|
||||||
import {
|
import {
|
||||||
preferences,
|
preferences,
|
||||||
updatePreferences,
|
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 slots: SetupContext['slots'] = useSlots();
|
||||||
const headerSlots = computed(() => {
|
const headerSlots = computed(() => {
|
||||||
|
@ -92,7 +92,7 @@ const [Form, formApi] = useTableForm({
|
|||||||
},
|
},
|
||||||
showCollapseButton: true,
|
showCollapseButton: true,
|
||||||
submitButtonOptions: {
|
submitButtonOptions: {
|
||||||
content: $t('common.query'),
|
content: computed(() => $t('common.search')),
|
||||||
},
|
},
|
||||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user