首页 > 解决方案 > Nativescript 生成的列表视图

问题描述

我正在尝试取自https://docs.nativescript.org/ui/components/list-view的示例的列表视图,但它只创建一个项目;我认为这里不起作用(listViewArray 有六个项目):

    listView.on(ListView.itemLoadingEvent, (args) => {
        if (!args.view) {
            // Create label if it is not already created.
            args.view = new Label();
            args.view.className = "list-group-item";
        }
        (args.view).text = listViewArray.getItem(args.index).title; (
    });

除此之外,我使用的示例与 GitHub 上公开的示例之间存在差异。

此外,该应用程序在 <page 令牌中公开了两个事件:

<Page loaded="onPageLoaded"
        navigatingTo="onNavigatingTo"
        xmlns:df="nativescript-ui-dataform"
        xmlns="http://schemas.nativescript.org/tns.xsd">

但它只执行navigatingTo事件。

谢谢

标签: listviewnativescript

解决方案


推荐阅读