mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-28 05:39:34 +08:00
feat: multi-language component
This commit is contained in:
@@ -6,6 +6,9 @@ import Button from '/@/components/Button/index.vue';
|
||||
import { BasicArrow } from '/@/components/Basic/index';
|
||||
|
||||
import { getSlot } from '/@/utils/helper/tsxHelper';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
|
||||
const { t } = useI18n('component.form');
|
||||
|
||||
export default defineComponent({
|
||||
name: 'BasicFormAction',
|
||||
@@ -55,14 +58,14 @@ export default defineComponent({
|
||||
setup(props, { slots, emit }) {
|
||||
const getResetBtnOptionsRef = computed(() => {
|
||||
return {
|
||||
text: '重置',
|
||||
text: t('resetButton'),
|
||||
...props.resetButtonOptions,
|
||||
};
|
||||
});
|
||||
|
||||
const getSubmitBtnOptionsRef = computed(() => {
|
||||
return {
|
||||
text: '查询',
|
||||
text: t('submitButton'),
|
||||
// htmlType: 'submit',
|
||||
...props.submitButtonOptions,
|
||||
};
|
||||
@@ -108,7 +111,7 @@ export default defineComponent({
|
||||
<Button type="default" class="mr-2" onClick={toggleAdvanced}>
|
||||
{() => (
|
||||
<>
|
||||
{isAdvanced ? '收起' : '展开'}
|
||||
{isAdvanced ? t('putAway') : t('unfold')}
|
||||
<BasicArrow expand={!isAdvanced} />
|
||||
</>
|
||||
)}
|
||||
|
@@ -1,14 +1,17 @@
|
||||
import type { ComponentType } from './types/index';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
|
||||
const { t } = useI18n('component.form');
|
||||
|
||||
/**
|
||||
* @description: 生成placeholder
|
||||
*/
|
||||
export function createPlaceholderMessage(component: ComponentType) {
|
||||
if (component.includes('Input') || component.includes('Complete')) {
|
||||
return '请输入';
|
||||
return t('input');
|
||||
}
|
||||
if (component.includes('Picker')) {
|
||||
return '请选择';
|
||||
return t('choose');
|
||||
}
|
||||
if (
|
||||
component.includes('Select') ||
|
||||
@@ -18,7 +21,7 @@ export function createPlaceholderMessage(component: ComponentType) {
|
||||
component.includes('Switch')
|
||||
) {
|
||||
// return `请选择${label}`;
|
||||
return '请选择';
|
||||
return t('choose');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
Reference in New Issue
Block a user