|
@@ -22,8 +22,9 @@ const ModelContext = (data) => {
|
|
fc.push(`export class ${prefix} extends BaseModel {`);
|
|
fc.push(`export class ${prefix} extends BaseModel {`);
|
|
// 处理字段
|
|
// 处理字段
|
|
for (const col of columns) {
|
|
for (const col of columns) {
|
|
- const { type, title } = col;
|
|
|
|
- const prop = _.pick(col, ['required', 'index', 'zh', 'remark', 'def']);
|
|
|
|
|
|
+ const { type, title, def } = col;
|
|
|
|
+ const prop = _.pick(col, ['required', 'index', 'zh', 'remark']);
|
|
|
|
+ if (def) prop.default = def;
|
|
const modelType = getModelType(type);
|
|
const modelType = getModelType(type);
|
|
fc.push(` @prop(${JSON.stringify(prop)})`);
|
|
fc.push(` @prop(${JSON.stringify(prop)})`);
|
|
fc.push(` ${title}: ${modelType}`);
|
|
fc.push(` ${title}: ${modelType}`);
|