How to create an instance of Dart Polymer custom element in Dart code?

前端 未结 2 1822
再見小時候
再見小時候 2021-01-02 15:12

There is a guide on how to create Dart web-ui custom element in Dart code. There is also sample code for this technique

Is there any example on how to create a Dart

相关标签:
2条回答
  • 2021-01-02 15:41

    I found a neat little snippet they're using on the source code of chromedeveditor, e.g. here on Github

    They use

    factory ExampleUi() => new Element.tag('ExampleUi');
    

    so that you could construct the element with:

    new ExampleUi();
    
    0 讨论(0)
  • 2021-01-02 16:02

    Here is the example code:

    import 'dart:html';
    import 'package:polymer/polymer.dart';
    
    main() {
      querySelector('#add-here').children.add(new Element.tag('my-element'));
    }
    

    Notice the use of new Element.tag('my-element').

    0 讨论(0)
提交回复
热议问题