【问题标题】:Nativescript Tabview is not rendered at all but there is no exception/error eitherNativescript Tabview 根本没有呈现,但也没有异常/错误
【发布时间】:2018-11-15 20:15:17
【问题描述】:

在我的 HTML 文件中,我有这个标记:虽然 ActionBar 显示了标题,但 stacklayout 中的选项卡视图根本不可见,而且我没有收到任何错误,但我不明白为什么???我是 nativescript 的新手... ;-)

任何人都可以看到我做错了什么?

<ActionBar title="Working days planner" class="action-bar">
</ActionBar> 

<StackLayout class="page">
    <TabView id="tabViewContainer">
        <TabViewItem title="First Tab">
            <StackLayout>
                <Label text="Working days" class="action-label m-15"></Label>
                <ListView [items]="items" class="list-group">
                    <ng-template let-item="item">
                        <Label [nsRouterLink]="['/item', item.id]" [text]="item.name" class="list-group-item"></Label>
                    </ng-template>
                </ListView>
            </StackLayout>
        </TabViewItem>
        <TabViewItem title="Second Tab">
            <StackLayout>
                <Label text="Second Tab" textWrap="true" class="m-15 h2 text-left" color="blue"></Label>
            </StackLayout>
        </TabViewItem>
    </TabView>
</StackLayout>

第一个 TabViewItem 中的 StackLayout 代码在将其放在 ActionBar 下时确实有效,但 TabView 组件以某种方式搞砸了一切。

【问题讨论】:

    标签: nativescript


    【解决方案1】:

    我还没有看到 TabViewItem 元素的这种语法。尝试从文档页面中的一个更简单的示例开始:

    NativeScript TabView for Angular

    一旦您获得了一个基本示例,请采取渐进步骤将内容更改为您的。此外,这是一项基本功能,因此您可以设置 Playground 示例并在遇到特定问题时分享。

    【讨论】:

    • 好的,我似乎从 nativescript 页面复制/粘贴了标记。您的链接适用于 angular@nativescript。所以我不能直接使用nativescript元素???
    【解决方案2】:

    尝试删除上面的StackLayout,你真的不需要它。

    【讨论】:

    • 我删除了所有没有帮助的 StackLayout:/ 并且我需要 StackLayout 将标签和 ListView 组件垂直分组,否则 ListView 会在标签上呈现。
    • 你使用的是 Angular 还是 Core NS?
    • 我在 NS 中使用 Angular :F
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-20
    • 2014-01-25
    • 2021-12-17
    • 2018-08-11
    • 2019-05-22
    • 2012-06-25
    相关资源
    最近更新 更多