fix: withDefaultPlaceholder
中将placeholder
修改为computed, 解决后续使用updateSchema
无法正常更新显示placeholder(响应式问题)
This commit is contained in:
parent
f415664acf
commit
2e064604c1
@ -1,3 +1,9 @@
|
|||||||
|
# 1.2.3
|
||||||
|
|
||||||
|
**BUG FIX**
|
||||||
|
|
||||||
|
- `withDefaultPlaceholder`中将`placeholder`修改为computed, 解决后续使用`updateSchema`无法正常更新显示placeholder(响应式问题)
|
||||||
|
|
||||||
# 1.2.2
|
# 1.2.2
|
||||||
|
|
||||||
**FEATURES**
|
**FEATURES**
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vben/web-antd",
|
"name": "@vben/web-antd",
|
||||||
"version": "1.2.2",
|
"version": "1.2.3",
|
||||||
"homepage": "https://vben.pro",
|
"homepage": "https://vben.pro",
|
||||||
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
"bugs": "https://github.com/vbenjs/vue-vben-admin/issues",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
@ -8,7 +8,7 @@ import type { Component } from 'vue';
|
|||||||
import type { BaseFormComponentType } from '@vben/common-ui';
|
import type { BaseFormComponentType } from '@vben/common-ui';
|
||||||
import type { Recordable } from '@vben/types';
|
import type { Recordable } from '@vben/types';
|
||||||
|
|
||||||
import { defineComponent, getCurrentInstance, h, ref } from 'vue';
|
import { computed, defineComponent, getCurrentInstance, h, ref } from 'vue';
|
||||||
|
|
||||||
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
import { ApiComponent, globalShareState, IconPicker } from '@vben/common-ui';
|
||||||
import { $t } from '@vben/locales';
|
import { $t } from '@vben/locales';
|
||||||
@ -49,10 +49,16 @@ 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无法显示(响应式问题)
|
||||||
|
*/
|
||||||
|
const placeholder = computed(
|
||||||
|
() =>
|
||||||
props?.placeholder ||
|
props?.placeholder ||
|
||||||
attrs?.placeholder ||
|
attrs?.placeholder ||
|
||||||
$t(`ui.placeholder.${type}`);
|
$t(`ui.placeholder.${type}`),
|
||||||
|
);
|
||||||
|
|
||||||
// 透传组件暴露的方法
|
// 透传组件暴露的方法
|
||||||
const innerRef = ref();
|
const innerRef = ref();
|
||||||
const publicApi: Recordable<any> = {};
|
const publicApi: Recordable<any> = {};
|
||||||
@ -66,7 +72,11 @@ const withDefaultPlaceholder = <T extends Component>(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return () =>
|
return () =>
|
||||||
h(component, { ...props, ...attrs, placeholder, ref: innerRef }, slots);
|
h(
|
||||||
|
component,
|
||||||
|
{ ...props, ...attrs, placeholder: placeholder.value, ref: innerRef },
|
||||||
|
slots,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user