看,这很好用:
class Page extends Spine.Model
@configure "Page", "name"
@extend Spine.Model.Ajax
但是这个:
class Page extends Spine.Model
@configure "Page", "name"
@extend Spine.Model.Ajax.Methods
@fetch (params) ->
index = @last()?.id or 0
return false if index is @index
@index = index
params or=
data: {index: index}
processData: true
@ajax().fetch(params)
不工作。当然,它从服务器获取记录,但其他 REST 命令不起作用。我无法更新或删除记录。我必须做什么才能恢复功能?我需要这个 fetch() 的例子,但我也需要更新和删除。