fix(DatePicker): date show is wrong and setup script defineExpose (#3324)

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(DatePicker): date show is wrong

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(useFormEvents): some function is lost in componentsProps

* fix(DatePicker): date show is wrong

* fix(DatePicker): date show is wrong
This commit is contained in:
zhang 2023-11-23 13:46:46 +08:00 committed by GitHub
parent 0cfaa40bd0
commit f62043b1fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 4 deletions

View File

@ -294,7 +294,7 @@
);
defineExpose({
setProps,
...formActionType,
});
onMounted(() => {

View File

@ -123,7 +123,10 @@ export function useFormEvents({
const { componentProps } = schema || {};
let _props = componentProps as any;
if (typeof componentProps === 'function') {
_props = _props({ formModel: unref(formModel), formActionType: unref(formElRef) });
_props = _props({
formModel: unref(formModel),
formActionType,
});
}
const constructValue = tryConstructArray(key, values) || tryConstructObject(key, values);
@ -338,6 +341,10 @@ export function useFormEvents({
return handleFormValues(values);
}
async function setProps(formProps: Partial<FormProps>): Promise<void> {
await unref(formElRef)?.setProps(formProps);
}
async function validate(nameList?: NamePath[] | false | undefined) {
let _nameList: any;
if (nameList === undefined) {
@ -380,6 +387,22 @@ export function useFormEvents({
}
}
const formActionType: Partial<FormActionType> = {
getFieldsValue,
setFieldsValue,
resetFields,
updateSchema,
resetSchema,
setProps,
removeSchemaByField,
appendSchemaByField,
clearValidate,
validateFields,
validate,
submit: handleSubmit,
scrollToField: scrollToField,
};
return {
handleSubmit,
clearValidate,

View File

@ -101,6 +101,10 @@
},
);
defineExpose({
wrap,
});
onMounted(() => {
if (props.native) return;
nextTick(update);

View File

@ -320,7 +320,7 @@
emit('register', tableAction, formActions);
defineExpose({ tableAction });
defineExpose({ ...tableAction });
</script>
<style lang="less">
@border-color: #cecece4d;

View File

@ -1,6 +1,6 @@
{
"lang": {
"shortWeekDays": ["一", "二", "三", "四", "五", "六", "日"],
"shortWeekDays": ["日","一", "二", "三", "四", "五", "六"],
"shortMonths": [
"1月",
"2月",