首页 > 解决方案 > StackLayout 中的 ngFor 在构建 apk 后显示为最后一个组件

问题描述

我有一个小视图StackLayout。使用时tns preview内部的组件按指定的顺序按预期显示。但是,在使用 apk 时,将CheckBoxes显示为StackLayout. 原因似乎是使用ngFor.

这是说明问题的两个屏幕截图:

使用 tns 预览时的正确行为

使用 apk 时的错误行为

这是我的代码:

<app-action-bar title="{{getTitle()}} - Lernen"></app-action-bar>

<StackLayout>

    <Label text="{{currentQuestion.question}}" textwrap="true"></Label>

    <CheckBox *ngFor="let answer of this.userAnswers" text="{{answer.answer}}"></CheckBox>

    <Button text="Weiter!"></Button>

    <Button text="Feedback"></Button>

</StackLayout>

我非常欢迎任何帮助!

标签: angularnativescriptnativescript-angular

解决方案


已在 @nativescript/angular 10.1.4 和 10.1.5 中修复


推荐阅读