formData的声明

This commit is contained in:
Xu Chang 2022-07-12 15:08:31 +08:00
parent ac950bf0fb
commit 6f3b706427
2 changed files with 7 additions and 4 deletions

View File

@ -201,11 +201,14 @@ export function makeCommonComponentMethods<
this.setState(data);
}
else {
/**
* data属性为undefined
* 使oakpage的entity属性为空也不行
*/
const data: Record<string, any> = formData ? await formData.call(this, {
data: undefined,
features,
props: this.props,
}) : {};
} as any) : {};
if (extra) {
assign(data, extra);
}

View File

@ -27,7 +27,7 @@ interface ComponentOption<
entity?: T;
isList: IsList;
formData?: (options: {
data?: IsList extends true ? RowSelected<ED, T>[] : RowSelected<ED, T>;
data: IsList extends true ? RowSelected<ED, T>[] : RowSelected<ED, T>;
features: BasicFeatures<ED, Cxt, AD & CommonAspectDict<ED, Cxt>> & FD;
props: Partial<WechatMiniprogram.Component.PropertyOptionToData<TProperty>>;
legalActions?: string[],
@ -74,7 +74,7 @@ interface PageOption<
}>;
actions?: ED[T]['Action'][];
formData?: (options: {
data?: IsList extends true ? RowSelected<ED, T, Proj>[] : RowSelected<ED, T, Proj>;
data: IsList extends true ? RowSelected<ED, T, Proj>[] : RowSelected<ED, T, Proj>;
features: BasicFeatures<ED, Cxt, AD & CommonAspectDict<ED, Cxt>> & FD;
props: Partial<WechatMiniprogram.Component.PropertyOptionToData<TProperty>>;
legalActions?: string[],