【发布时间】:2019-08-06 04:00:43
【问题描述】:
我正在使用backbone.js,用coffeescript编写它,但出现此错误并且无法解决!
代码片段:
module.exports = class CoreModel extends Backbone.Model
destroyed: false
# Helper to toggle the state of boolean value (using not)
toggle: (key) -> @swap key, invert
# Helper to change the value of an entry using a function.
swap: (key, f) -> @set key, f @get key
toJSON: -> if @destroyed then 'DESTROYED' else super
错误:
[stdin]:11:45: error: unexpected else
toJSON: -> if @destroyed then 'DESTROYED' else super
^^^^
不知道为什么这是一个意想不到的事情!
【问题讨论】: