Dynamically create polymer element

前端 未结 2 547
Happy的楠姐
Happy的楠姐 2020-12-11 08:19

I have defined login element as follows:


  

        
相关标签:
2条回答
  • 2020-12-11 08:39
    factory MyLogin() => document.createElement("form", "my-login");
    

    Then you can just call:

    MyLogin login = new MyLogin();
    

    This works for me.

    0 讨论(0)
  • 2020-12-11 08:48

    You should instantiate it as

    Element y = new Element.tag('form', 'my-login');
    

    What seems not to work is

    MyLogin y = new Element.tag('form', 'my-login');
    

    this should result in the HTML for the inserted element

    <form is="my-login"></form>
    
    0 讨论(0)
提交回复
热议问题