【发布时间】:2018-11-26 22:54:32
【问题描述】:
我有点卡在这里,我认为可以简单地解决。 Nativescript + Angular 的新手。
我从 Nativescript 文档中获取了 Tabview 代码并添加了一个 ng 容器,以显示我通过服务提供的一组数据(主要是对 json 的单个 http 请求)并在 ngOnInit() 中对其进行初始化。 使用以下代码,我得到的数据在 TabTitle (*tabItem) 中正确显示,但问题就在下一行开始。
在 Android 上,我的前两个选项卡是空的。只有当滑动到第四个标签而不是向后滑动到第一个时,我的两个标签才会出现。 (当再次滑动到第三个并向后滑动时,只会出现第一个。) 在 iOS 上,这个问题不会发生。知道如何重新加载 Android 上的第一个选项卡,或者为什么会发生这种情况?任何帮助表示赞赏,谢谢!
这是我的 component.html
<ActionBar class="action-bar">
<Label class="action-bar-title" [text]="timetableName"></Label>
</ActionBar>
<TabView id="tabViewContainer">
<ng-container *ngFor="let tab of tabTitles; let i = index">
<StackLayout *tabItem="{title: tab + ' Tab'}">
<StackLayout>
<Label [text]="tab" textWrap="true" class="m-15 h2 text-left" color="blue"></Label>
</StackLayout>
</StackLayout>
</ng-container>
</TabView>
I've attached a short gif,显示缺失和出现的标签。
Here's the reproduced issue 在 Nativescript Playground 上。
【问题讨论】:
-
我无法在Playground 上重现该问题,您能否试一试并进行必要的更改,以便我们看到问题。
-
@Manoj 谢谢!我在你的操场上为你重现了这个问题。我将在 Mainpost 上附上示例以获得更好的概述。 link
标签: android angular nativescript