import { Component, OnInit, Input } from "@angular/core"; @Component({ selector: "app-doc-api", templateUrl: "./doc-api.component.html", styleUrls: ["./doc-api.component.scss"] }) export class DocApiComponent implements OnInit { @Input() properties: Array = []; @Input() others: Array = []; @Input() columns: any[] = [ { name: '参数', field: "propertiy", width: 250 }, { name: '说明', field: "description", width: 500 }, { name: '类型', field: "type", width: 250 }, { name: '默认值', field: "default", width: 250 } ]; @Input() dataSource: any[]; @Input() random = false; constructor() {} getValue(prop: string, obj: any) { if (obj[prop] !== undefined && obj[prop] !== null) { return obj[prop]; } return ''; } ngOnInit() {} }