【发布时间】:2015-06-30 08:32:29
【问题描述】:
我试图为AngularJS-Toaster 使用枚举
class Toaster extends js.Object{
// see https://github.com/jirikavi/AngularJS- Toaster/blob/master/toaster.js#L58
def pop(`type` : ToasterType,title : String,body:String) : Unit = js.native
}
这样的枚举
object ToasterType extends Enumeration{
type ToasterType = Value
val Success = Value("success")
...
}
然后像这样调用
toaster.pop(ToasterType.Success, "some title", "text")
当烤面包机弹出时,没有标题或文本。当我在pop 定义上使用字符串类型并传递“成功”时,一切都按预期工作。
(我使用了http://www.scala-js.org/doc/semantics.html 和https://github.com/scala-js/scala-js/issues/38。认为上面应该可以工作,不是吗?)
【问题讨论】: