fix generate

接口返回list如果是nil,则赋值为空数组
前端State类加构造函数
This commit is contained in:
maxbad
2024-01-08 17:51:20 +08:00
parent de78b3604e
commit b051c98dec
3 changed files with 6 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ func (l *gCurd) generateWebModelState(ctx context.Context, in *CurdPreviewInput)
}
buffer.WriteString(fmt.Sprintf(" public %s = %v; // %s\n", field.TsName, value, field.Dc))
}
buffer.WriteString("\n constructor(state?: Partial<State>) {\n if (state) {\n Object.assign(this, state);\n }\n }")
buffer.WriteString("}")
return buffer.String()
}