【问题标题】:Add web component to the DOM将 Web 组件添加到 DOM
【发布时间】:2012-12-12 00:19:50
【问题描述】:

我创建了扩展 DIV 元素的 dart Web 组件。 在 DART 中,我可以向 DOM 添加一个 DIV 元素:

DivElement div = new DivElement();
document.body.elements.add(div);

Dart html api

我可以对我的 Web 组件做同样的事情吗? 什么是正确的语法?

【问题讨论】:

    标签: dart dart-webui


    【解决方案1】:

    Web UI 规范有一个关于 Web 组件实例化的部分:

    http://www.dartlang.org/articles/dart-web-components/spec.html#instantiation

    ... 在 Dart 中调用 new FooComponent.forElement(elem)。我们不推荐 使用这种方法,因为这个构造函数调用不能被 本身——它需要几个设置步骤。我们可能有运行时 图书馆让这在未来更容易......

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-04
      • 1970-01-01
      • 2016-05-17
      • 2021-04-27
      • 2013-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多