0

为什么当我单击一行的编辑按钮时,模态会意外打开?就像 - 可以打开几行,然后其他行不会。或者当我尝试单击那些未打开的行时,它们已经可以令人惊讶地打开了。完全不可预测。

这是我的代码:

部分列表:

showDialogBox : boolean = false;

onToggleDialogBox(id) {
    this.showDialogBox = !this.showDialogBox;
    console.log(id);
}
<table class="ui very basic table">
    <thead>
        <tr>
            <th width="35%">Name</th>
            <th>Remarks</th>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr *ngFor="let section of dataSource['docs']">
            <td><h4>{{section.name}}</h4></td>
            <td>{{section.remark}}</td>
            <td class="collapsing">
                <div class="ui small basic icon buttons">
                    <button class="ui button"><i class="write icon" (click)="onToggleDialogBox(section._id)"></i></button>
                    <button class="ui button"><i class="trash icon"></i></button>
                </div>
            </td>
        </tr>
    </tbody>
</table>
<app-dialog-form *ngIf="showDialogBox" [(showDialogBox)]="showDialogBox" #form>
    {{formTitle}}
    <div class="action" action>
        <button class="ui button basic" (click)="onToggleDialogBox()">Cancel</button>
        <button class="ui button primary medium" (click)="addSection(form.formValues)">Save</button>
    </div>
</app-dialog-form>

对话形式:

(我认为不需要 HTML,因为我只想知道为什么单击上面的编辑图标/按钮后模态的显示是不可预测的)

@Input() showDialogBox : boolean = true;
@Output() showDialogBoxChange = new EventEmitter<boolean>();

4

0 回答 0