在dart中如何使用PaperInputBehavior扩展自定义PolymerElement?

时间:2016-02-22 20:27:07

标签: dart dart-polymer

基本上我尝试将一个GoldCcCvcInput端口用于dart实现,而不是包装js实现。

看着这个: https://github.com/PolymerElements/gold-cc-cvc-input/blob/master/gold-cc-cvc-input.htmlhttps://github.com/dart-lang/polymer-dart/wiki/behaviors

一起使用

类似的东西:

 @PolymerRegister('nbdate-input')
 class NbdateInput extends PolymerElement with PaperInputBehavior,
 IronControlState, IronA11yKeysBehavior ...

最小的测试项目 https://github.com/jonboj/inputbehavior-dart.git

项目初始化时不会转储任何错误消息,并显示铁输入元素。但是当其中一个铁输入元素被放在焦点上时,下面的例外将被转储到控制台中:

Uncaught TypeError: Cannot read property 'focus' of undefined
  Polymer.PaperInputBehaviorImpl._onFocus   
  handler   
  Polymer.Base._addFeature.fire 
  Polymer.IronControlState._focusBlurHandler

这覆盖了方法onFocusedChanged https://github.com/PolymerElements/gold-cc-cvc-input/blob/master/gold-cc-cvc-input.html#L219

在dart中,会触发相应的Observer,并在异常转储后发生打印输出。

https://github.com/jonboj/inputbehavior-dart/blob/master/lib/nbdatebehavior_input.dart#L56

2 个答案:

答案 0 :(得分:1)

我会检查控制台是否有错误,mixin排序看起来不正确,它应该在消息中给你所需的顺序,这可能会解决你的问题(我希望这样的排序{{1 }})。

此外,请确保在构造函数中调用IronA11yKeysBehavior, IronControlState, PaperInputBehavior

答案 1 :(得分:0)

相关问题