Coffeescript 方法链接与嵌套方法
我不熟悉咖啡脚本。然而,我没有找到合适的词来提出这个问题 我有一个这样的咖啡脚本:Coffeescript 方法链接与嵌套方法,coffeescript,Coffeescript,我不熟悉咖啡脚本。然而,我没有找到合适的词来提出这个问题 我有一个这样的咖啡脚本: @collection.each (student) => ($(@el).find("#table .table").append new Item({model:student}).el) .find("td:last-child").hide() 有什么比这种难看的语法更好的方法来进行方法链接呢?我只想找到$
@collection.each (student) =>
($(@el).find("#table .table").append new Item({model:student}).el)
.find("td:last-child").hide()
有什么比这种难看的语法更好的方法来进行方法链接呢?我只想找到$(@el)中的td:last child。没有括号?怎么做?有人能从上面提到的语法中提出更好的建议吗 为什么不在
append
上加上括号以匹配其他函数调用
@collection.each (student) =>
$(@el).find("#table .table")
.append(new Item(model: student).el)
.find("td:last-child")
.hide()
为什么不在
append
上加上括号以匹配其他函数调用
@collection.each (student) =>
$(@el).find("#table .table")
.append(new Item(model: student).el)
.find("td:last-child")
.hide()
因此,在某种程度上,我仍然需要用括号来区分物品和查找链接,对吗?@Joy:如果你想链接,你将需要括号。因此,在某种程度上,我仍然需要用括号来区分物品和查找链接?@Joy:如果你想链接,你将需要括号我想要锁链。