延迟重复的calculateItemHeight索引始终未定义 [英] Lazy repeat calculateItemHeight index is always undefined

查看:77
本文介绍了延迟重复的calculateItemHeight索引始终未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ons-lazy-repeat,并且我希望根据物品的高度来改变物品的高度.

I'm using ons-lazy-repeat and I want to have variable item heights depending on the item.

为此,如文档中所述,我正在使用带有calculateItemHeight函数的委托对象.

For that I'm using, as described in the documentation, a delegate object with a calculateItemHeight function.

问题在于所有项目的高度都被设置为20,因为最初 index 变量始终为 undefined .之后,一切似乎都可以正常运行,但是所有内容都已经在ui上呈现.

The problem is all item heights are being set to 20 because initially the index variable is always undefined. Afterwards everything seems to work correctly but everything is already rendered on the ui.

还有其他人有同样的问题吗?我看不到我在做什么错.

Anyone else have the same problem? I don't see what I'm doing wrong here.

这是我的委托对象:

   $scope.TransactionDelegate = {
    configureItemScope: function(index, itemScope) {
        itemScope.item = TransactionService.allTransactions[index];
    },
    calculateItemHeight: function(index) {
        if (!index)
            return 20;

        return 60;
    },
    countItems: function() {
        return TransactionService.allTransactions.length;
    },
    destroyItemScope: function(index, scope) {
        ;
    }
  };

谢谢

推荐答案

这是一个已知的 bug 现在已修复,将在下一版本中发布.

This is a know bug that is now fixed and will be released in the next version.

这篇关于延迟重复的calculateItemHeight索引始终未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆