Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

多语言无刷新切换时,BasicColumn和FormSchema里面的值不能正常切换 #6908

Closed
xsf1006 opened this issue Jul 17, 2024 · 3 comments

Comments

@xsf1006
Copy link

xsf1006 commented Jul 17, 2024

版本号:
问题描述:

多语言无刷新切换时,BasicColumn和FormSchema里面的值不能正常切换

错误截图:

image

友情提示:

  • 未按格式要求发帖、描述过于简单的,会被直接删掉;
  • 描述问题请图文并茂,方便我们理解并快速定位问题;
  • 如果使用的不是master,请说明你使用的分支;
@zhangdaiscott
Copy link
Member

zy

@liaozhiyang
Copy link

已修复,下一版本发布。

你本地可按如下进行修改:

src/components/Table/src/hooks/useColumns.ts
image

if (isArray(columns)) {
      columns.forEach((item) => {
        item.title = isFunction(item.title) ? item.title() : item.title;
      });
    }

src/components/Form/src/components/FormItem.vue
image
image

import { useLocaleStoreWithOut } from '/@/store/modules/locale';
 const localeStore = useLocaleStoreWithOut();

if (isCreatePlaceholder && component !== 'RangePicker' && component) {
          //自动设置placeholder
          propsData.placeholder = unref(getComponentsProps)?.placeholder || createPlaceholderMessage(component) + props.schema.label;
          // update-begin--author:liaozhiyang---date:20240723---for:【issues/6908】多语言无刷新切换时,BasicColumn和FormSchema里面的值不能正常切换
          let label = isFunction(props.schema.label) ? props.schema.label() : props.schema.label;
          if (localeStore.getLocale === 'en' && !(/^\s/.test(label))) {
            label = ' ' + label;
          }
          // update-end--author:liaozhiyang---date:20240723---for:【issues/6908】多语言无刷新切换时,BasicColumn和FormSchema里面的值不能正常切换
          propsData.placeholder = unref(getComponentsProps)?.placeholder || createPlaceholderMessage(component) + label;
        }

const { label: itemLabel, helpMessage, helpComponentProps, subLabel, labelLength } = props.schema;
        // update-begin--author:liaozhiyang---date:20240723---for:【issues/6908】多语言无刷新切换时,BasicColumn和FormSchema里面的值不能正常切换
        const label = isFunction(itemLabel) ? itemLabel() : itemLabel;
        // update-end--author:liaozhiyang---date:20240723---for:【issues/6908】多语言无刷新切换时,BasicColumn和FormSchema里面的值不能正常切换

src/components/Table/src/components/settings/ColumnSetting.vue
image

import { useLocaleStoreWithOut } from '/@/store/modules/locale';
const localeStore = useLocaleStoreWithOut();
watch(localeStore, () => {
        const columns = getColumns();
        plainOptions.value = columns;
        plainSortOptions.value = columns;
        cachePlainOptions.value = columns;
      });

@liaozhiyang
Copy link

效果如下:

iShot_2024-07-23_11 12 01

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants