【修复】【cfg】修复 生成Typescript读取json格式数据的代码的bug
parent
428652b433
commit
5868f9bd0a
|
|
@ -26,8 +26,7 @@ namespace {{x.namespace}} {
|
|||
export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def_type}} extends {{x.parent}}{{end}} {
|
||||
{{~if x.is_abstract_type~}}
|
||||
static deserialize(_json_ : any) : {{name}} {
|
||||
switch (_json_.__type__)
|
||||
{
|
||||
switch (_json_.__type__) {
|
||||
case null : return null;
|
||||
{{~ for child in x.hierarchy_not_abstract_children~}}
|
||||
case '{{child.name}}': return new {{child.full_name}}(_json_);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace Luban.Job.Cfg.TypeVisitors
|
|||
}
|
||||
else
|
||||
{
|
||||
return $"{{ {fieldName} = []; for(var _ele of {jsonVarName}) {{ let _e :{type.ElementType.Apply(TypescriptDefineTypeName.Ins)};{type.ElementType.Apply(this, "_ele", "_e")} {fieldName}.push(_e);}}}}";
|
||||
return $"{{ {fieldName} = []; for(let _ele of {jsonVarName}) {{ let _e :{type.ElementType.Apply(TypescriptDefineTypeName.Ins)};{type.ElementType.Apply(this, "_ele", "_e")} {fieldName}.push(_e);}}}}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ namespace Luban.Job.Cfg.TypeVisitors
|
|||
}
|
||||
else
|
||||
{
|
||||
return $"{{ {fieldName} = []; for(var _ele of {jsonVarName}) {{ let _e : {type.ElementType.Apply(TypescriptDefineTypeName.Ins)};{type.ElementType.Apply(this, "_ele", "_e")} {fieldName}.push(_e);}}}}";
|
||||
return $"{{ {fieldName} = []; for(let _ele of {jsonVarName}) {{ let _e : {type.ElementType.Apply(TypescriptDefineTypeName.Ins)};{type.ElementType.Apply(this, "_ele", "_e")} {fieldName}.push(_e);}}}}";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue