0
我有这样的代码在咖啡脚本类的构造函数:胖箭头不工作coffescript?
@item.find("li").draggable(start: @startConnection, drag: @updateConnection).droppable(drop: @dropConnection)
与类的三种方法:
startConnection:(ev,ui) =>
@currentConnection = new Connection(ui.offset)
updateConnection:(ev,ui) =>
@currentConnection.update(ui.offset)
dropConnection:(ev,ui) =>
@currentConnection.finish(ui.draggable, ui.offset)
和我:
Uncaught TypeError: Cannot call method 'finish' of undefined
当我滴该项目,但没有更新时:看起来@currentConnection在update()中正确定义,但不在dropConnection()中定义。
为什么?我没有得到什么错误?
你能显示完整的代码吗? – Cyclonecode
是否要将一个列表项目拖放到另一个列表项目上? 'droppable'项目是目标,你拖动'可拖动'的项目。 – hpaulj
我想我明白发生了什么:这里是更好地反映我的问题的代码:http://jsfiddle.net/QxKb5/2/ –