update: placeholder update
This commit is contained in:
parent
f096dfc6e6
commit
e587256425
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user