首页 文章

在nativescript中刷新刷新

提问于
浏览
0

我试图拉动刷新,但我使用的设计没有满足我的主管 . 如何在nativescript中刷新这一点,现在我在我的项目中使用这个插件https://www.npmjs.com/package/nativescript-pulltorefresh,我不知道怎么做,可以给一些建议吗?

enter image description here

1 回答

  • 0

    如果您想在需要时使用 virtual-array 模块进行动态加载项目 .

    Link to documentation examples

    Link to documentation info

    这个想法是你可以创建一个可观察的 virtual array ,它具有初始大小和 loadSize 实例属性 . 然后在 itemsLoadingEvent 上,您可以控制新资源的加载 .

    var array = new virtualArrayModule.VirtualArray(100);
    array.loadSize = 15;
    array.on(virtualArrayModule.VirtualArray.itemsLoadingEvent, function (args) {
        // Argument (args) is ItemsLoading.
        // args.index is start index of the page where the requested index is located.
        // args.count number of requested items.
        //
        // Note: Virtual array will divide total number of items to pages using "loadSize" property value. When you request an 
        // item at specific index the array will raise "itemsLoading" event with "ItemsLoading" argument index set to the first index of the requested page
        // and count set to number of items in this page. 
        //
        // Important: If you have already loaded items in the requested page the array will raise multiple times "itemsLoading" event to request 
        // all ranges of still not loaded items in this page. 
        var itemsToLoad = new Array();
        for (var i = 0; i < args.count; i++) {
            itemsToLoad.push(i + args.index);
        }
        array.load(args.index, itemsToLoad);
    });
    

    您可以在此示例应用中找到此功能的更多高级示例here

相关问题