Javascript Coffee脚本编译错误
这是我的咖啡,我简直不明白为什么这是错的。我总是遇到一个意想不到的错误Javascript Coffee脚本编译错误,javascript,coffeescript,Javascript,Coffeescript,这是我的咖啡,我简直不明白为什么这是错的。我总是遇到一个意想不到的错误 renderTable:()=> @table = d3.select("#search-results-area").append("table").attr("id",@tableId).attr("class","visualization-panel") @thead = @table.append("thead") @tbody = @table.append("tbody")
renderTable:()=>
@table = d3.select("#search-results-area").append("table").attr("id",@tableId).attr("class","visualization-panel")
@thead = @table.append("thead")
@tbody = @table.append("tbody")
@input = @table.append("input").attr("id",@inputId).on("keydown",(d)=>
console.log("keydown")
console.log
toFilter = $(@input[0][0]).val()
window.setTimeout(()=>
toFilter = $(@input[0][0]).val()
@tbody.selectAll("tr")
,500)
)
当我拿出@tbody.selectAll(“tr”)
时,这就起作用了,这让我很困惑
我该如何解决这个问题 我认为这与定义
窗口的方式有关。setTimeout
部分。最后的,500)
片段由于缩进和括号而导致编译错误。尝试将该部分更改为:
window.setTimeout ( ->
toFilter = $(@input[0][0]).val()
@tbody.selectAll("tr")
), 500
使结束页缩进到与
窗口相同的位置。这将修复编译。我相信这与定义窗口的方式有关。setTimeout
部分。最后的,500)
片段由于缩进和括号而导致编译错误。尝试将该部分更改为:
window.setTimeout ( ->
toFilter = $(@input[0][0]).val()
@tbody.selectAll("tr")
), 500
使结束页缩进到与窗口相同的位置。这应该可以解决编译问题