Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
#中@index上的meteor helper函数各不工作-未定义索引_Meteor - Fatal编程技术网

#中@index上的meteor helper函数各不工作-未定义索引

#中@index上的meteor helper函数各不工作-未定义索引,meteor,Meteor,我试图使用助手在#each循环中增加一个值,但似乎循环中的@index变量没有被传递 以下是循环的外观: {{#each thing.subthing}} {{offset @index}} {{/each}} 下面是助手: Template.mytemplate.helpers({ "offset": function(index){ index += 5; console.log("index = "+index); retu

我试图使用助手在#each循环中增加一个值,但似乎循环中的@index变量没有被传递

以下是循环的外观:

{{#each thing.subthing}}
    {{offset @index}}
{{/each}}
下面是助手:

Template.mytemplate.helpers({
    "offset": function(index){
        index += 5;
        console.log("index = "+index);
        return index;
    }
});
控制台正在记录“未定义”,即使我在修改索引之前检查了索引的值


知道怎么回事吗?我使用的是meteor 1.2.1,所以@index对我来说不是一个问题。

这是一个版本控制问题。我的meteor安装版本是1.2.1,但其中一个组件必须进行更新。我运行了meteor--更新,现在一切正常:-)

结果是版本控制问题。我的meteor安装版本是1.2.1,但其中一个组件必须进行更新。我运行了meteor--更新,现在一切都正常了:-)

你确定
这个东西。子内容
是可移植的吗?你能展示它的一个实例吗?是的,我可以很好地看到迭代的内容。只是@index不起作用。事实上,即使没有helper(即,如果我在每个循环中使用{{@index}}),它也不起作用。记录
thing.subthing
本身,尝试迭代一个普通数组,看看是否有变化。您确定
thing.subthing
是可编辑的吗?你能展示它的一个实例吗?是的,我可以很好地看到迭代的内容。只是@index不起作用。事实上,即使没有helper(即,如果我在每个循环中使用{{@index}}),它也不起作用。记录
thing.subthing
本身,尝试迭代一个普通数组,看看是否有变化。