Javascript Meteor Spacebars自定义拆分辅助对象未渲染

Javascript Meteor Spacebars自定义拆分辅助对象未渲染,javascript,meteor,spacebars,Javascript,Meteor,Spacebars,我正在尝试滚动自定义帮助程序以转换如下字符串: category = "Technology, Programming, Food, Cats"; 排列成一个数组。到目前为止,我得到了: positem.js Template.postItem.helpers({ split: function(stringCategory){ //split the string based on , and " ". var cat = stringCategory

我正在尝试滚动自定义帮助程序以转换如下字符串:

category = "Technology, Programming, Food, Cats";
排列成一个数组。到目前为止,我得到了:

positem.js

Template.postItem.helpers({
    split: function(stringCategory){
        //split the string based on , and " ".
        var cat = stringCategory.split(/,| /);
        window.console.info(cat);
        return cat;
    }
});
问题是在渲染时,我不知道还要尝试什么,但下面的代码:

positem.html

    {{#each split category}}
        {{cat}}
    {{/each}}
它根本不返回任何东西。。。有人能帮我吗

看一看。这从v1.2开始就得到了支持

category
作为参数后,您的
split
帮助程序不会返回,因此,您可以更新模板以使用子表达式

{{#each (split category)}}
    {{cat}}
{{/each}}

“猫”应该是一个模板吗?如果要调用模板,应该在左边有一个>。我想把它打印成一个属性谢谢你的帮助和指点文档!我还需要将
cat:function(){return this.split();}
添加到我的助手函数中。