1

我是咖啡脚本的新手。但是我没有找到任何合适的词来提出这个问题。

我有一个这样的咖啡脚本:

@collection.each (student) =>               
            ($(@el).find("#table .table").append new Item({model:student}).el)
                .find("td:last-child").hide()   

但是,有没有比这种丑陋的语法更好的方法链接?我只想从 $(@el) 中找到 td:last-child,不带任何括号。我怎样才能做到这一点?

4

1 回答 1

1

为什么不在括号上加上append其他函数调用呢?

@collection.each (student) =>     
    $(@el).find("#table .table")
        .append(new Item(model: student).el)
        .find("td:last-child")
        .hide()
于 2012-09-20T05:51:47.333 回答