【发布时间】:2019-06-11 17:42:13
【问题描述】:
我有两个组件 A(app-table) 和 B(app-edit),我正在使用 Tabulator-table 库在这两个组件中生成表格。加载页面时,它应该只加载表 A。组件 B 的“正在加载”布尔值为 false,只有在单击表上的单元格时才变为 true,我正在使用回调函数将加载值设置为 true 或 false。在控制台(使用 console.log)上,我可以看到布尔值在单击时从 false 变为 true,但它不会改变视图。这意味着组件 B 永远不会出现在页面上。
componentA.ts
import {
Component,
OnInit
} from '@angular/core';
@Component({
selector: 'app-schedule',
templateUrl: './schedule.component.html',
styleUrls: ['./schedule.component.scss']
})
export class ScheduleComponent implements OnInit {
public loading: boolean = true;
constructor() {}
openEdit(e, cell) {
this.openEditValue = false
console.log(this.openEditValue)
}
columnNames = [
{
title: "description",
field: "description"
},
{
title: "shortCode",
field: "wbsElement.shortCode",
cellClick: this.openEdit
},
];
}
ngOnInit() {
}
componentA.html
<app-table
[tableRowData]= "schedule"
[columnNames]= "columnNames"
[tableID]= "tableID">
</app-table>
<div *ngIf= "loading">
<app-edit ></app-edit>
</div>
【问题讨论】:
标签: angular typescript tabulator