How to focus after initialization with emberjs?

后端 未结 2 1778
一生所求
一生所求 2021-02-20 12:26

I\'m new to Ember.js. I want to focus on TextField(in sample, id=\"text\") after initialization, but in ready function, doesn\'t work focus method...



        
2条回答
  •  清酒与你
    2021-02-20 13:05

    Subclassing TextField and then spreading a custom View around your templates seemed a bit messy to me, so I wrote this little 1kb package that lets you do this more elegantly, directly in the template, without any further coding:

    
      
      
      
      
      
      
      
      
      
    
    

    You can get it from https://github.com/AndreasPizsa/ember-autofocus or with bower install ember-autofocus. I appreciate feedback!

提交回复
热议问题