mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2025-12-30 09:42:25 +00:00
fix: withDefaultPlaceholder中placeholder 在keepalive & 语言切换 & tab切换 显示不变的问题
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
**BUG FIX**
|
||||
|
||||
- 菜单管理 路由地址的必填项不生效
|
||||
- withDefaultPlaceholder中placeholder 在keepalive & 语言切换 & tab切换 显示不变的问题
|
||||
|
||||
**REFACTOR**
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import type { BaseFormComponentType } from '@vben/common-ui';
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import {
|
||||
computed,
|
||||
defineAsyncComponent,
|
||||
defineComponent,
|
||||
getCurrentInstance,
|
||||
@@ -93,10 +94,13 @@ const withDefaultPlaceholder = <T extends Component>(
|
||||
name: component.name,
|
||||
inheritAttrs: false,
|
||||
setup: (props: any, { attrs, expose, slots }) => {
|
||||
const placeholder =
|
||||
props?.placeholder ||
|
||||
attrs?.placeholder ||
|
||||
$t(`ui.placeholder.${type}`);
|
||||
// 改为placeholder 解决在keepalive & 语言切换 & tab切换 显示不变的问题
|
||||
const computedPlaceholder = computed(
|
||||
() =>
|
||||
props?.placeholder ||
|
||||
attrs?.placeholder ||
|
||||
$t(`ui.placeholder.${type}`),
|
||||
);
|
||||
|
||||
// 透传组件暴露的方法
|
||||
const innerRef = ref();
|
||||
@@ -115,7 +119,7 @@ const withDefaultPlaceholder = <T extends Component>(
|
||||
component,
|
||||
{
|
||||
...componentProps,
|
||||
placeholder,
|
||||
placeholder: computedPlaceholder.value,
|
||||
...props,
|
||||
...attrs,
|
||||
ref: innerRef,
|
||||
|
||||
Reference in New Issue
Block a user