angular-docs-cn/public/docs/_examples/cb-dynamic-form/ts/app/question-base.ts

26 lines
575 B
TypeScript

// #docregion
export class QuestionBase<T>{
value:T;
key:string;
label:string;
required:boolean;
order:number;
controlType:string;
constructor(options:{
value?:T,
key?:string,
label?:string,
required?:boolean,
order?:number,
controlType?:string
} = {}){
this.value = options.value;
this.key = options.key || '';
this.label = options.label || '';
this.required = !!options.required;
this.order = options.order === undefined ? 1 : options.order;
this.controlType = options.controlType || '';
}
}