update: placeholder update

This commit is contained in:
dap 2025-04-16 13:53:58 +08:00
parent f096dfc6e6
commit e587256425

View File

@ -9,7 +9,6 @@ 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,
@ -91,15 +90,10 @@ const withDefaultPlaceholder = <T extends Component>(
inheritAttrs: false, inheritAttrs: false,
name: component.name, name: component.name,
setup: (props: any, { attrs, expose, slots }) => { setup: (props: any, { attrs, expose, slots }) => {
/** const placeholder =
* 使computed updateSchema更新的placeholder无法显示() props?.placeholder ||
*/ attrs?.placeholder ||
const placeholder = computed( $t(`ui.placeholder.${type}`);
() =>
props?.placeholder ||
attrs?.placeholder ||
$t(`ui.placeholder.${type}`),
);
// 透传组件暴露的方法 // 透传组件暴露的方法
const innerRef = ref(); const innerRef = ref();
@ -118,7 +112,7 @@ const withDefaultPlaceholder = <T extends Component>(
component, component,
{ {
...componentProps, ...componentProps,
placeholder: placeholder.value, placeholder,
...props, ...props,
...attrs, ...attrs,
ref: innerRef, ref: innerRef,