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