【问题标题】:How can I change the coffeescript class extends style to cc.Class.extends({ator:function(){} ...})?如何将咖啡脚本类扩展样式更改为 cc.Class.extends({ator:function(){} ...})?
【发布时间】:2014-09-10 09:35:17
【问题描述】:
class  Son extends Father   

作为 js 的咖啡脚本:

Son = function(){ __extends=function(){...} .... Son::ator = function(){} return Son}

但我需要这个:

Son = Father.extends({ator:function (){}}) 

当 bassClass 不是咖啡类时,本机“扩展”不会用于所有内容。所以 我可以通过更改咖啡脚本代码来使用新样式“扩展”吗?如果可以,如何?

【问题讨论】:

  • 你所说的“原生扩展”是什么意思 - 咖啡脚本之一?什么是“新风格延伸”? Father.extends 是在哪里定义的?

标签: javascript coffeescript extends


【解决方案1】:

我需要这个:

Son = Father.extends({ator:function (){}})

我看不出使用 CoffeeScript 的 extends 有什么问题,但如果你想编写编译为上述代码的代码,只需使用

Son = Father.extends
    ator: () ->

【讨论】:

    猜你喜欢
    • 2013-10-30
    • 2012-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-04-10
    • 2013-01-09
    • 2014-01-20
    • 2017-07-06
    相关资源
    最近更新 更多