2016-02-22 31 views
0

基本上我試着做一個端口GoldCcCvcInput飛鏢執行,而不是包裝的js實現。在dart中如何使用PaperInputBehavior擴展自定義PolymerElement?

看着這樣的: https://github.com/PolymerElements/gold-cc-cvc-input/blob/master/gold-cc-cvc-input.html 加上https://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 

這具有方法onFocusedChangedhttps://github.com/PolymerElements/gold-cc-cvc-input/blob/master/gold-cc-cvc-input.html#L219

在鏢相應觀察被觸發的替代時,在異常轉儲後發生打印輸出。

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

回答

1

我會檢查錯誤控制檯中,混入排序並不像它是正確的,它應該給你一個消息所需的排序,這可能解決您的問題(我期望的像這樣訂購IronA11yKeysBehavior, IronControlState, PaperInputBehavior)。

此外,請確保您在構造函數中調用polymerCreated()

+0

感謝您的反饋結構如下提供。現在我已經用更多信息和示例回購編輯了這個問題。檢查*)訂單'IronA11yKeysBehavior,IronControlState,PaperInputBehavior'它在初始化時在控制檯中轉儲一個異常,並且按照mixin的順序。 *)根據api'polymerCreated()'調用將在'NbdatebehaviorInput.created():super.created()' –

+0

調用我已經進一步研究了這一點。也許所需的功能可以通過將一些東西放在一個''中來獲得,也許這個框架也是可以實現的。我會進一步調查。 –

相關問題