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); this.setState(data);
} }
else { else {
/**
* data属性为undefined
* 使oakpage的entity属性为空也不行
*/
const data: Record<string, any> = formData ? await formData.call(this, { const data: Record<string, any> = formData ? await formData.call(this, {
data: undefined,
features, features,
props: this.props, props: this.props,
}) : {}; } as any) : {};
if (extra) { if (extra) {
assign(data, extra); assign(data, extra);
} }

View File

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