當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Dart Element.created用法及代碼示例

dart:html 庫中Element.created 的用法介紹如下。

用法:

Element.created()

自定義元素創建構造函數。

當創建自定義元素時,DOM 會使用此構造函數。它隻能由 Element 的子類從該類創建的構造函數中調用。

class CustomElement extends Element {
  factory CustomElement() => new Element.tag('x-custom');

  CustomElement.created() : super.created() {
     // Perform any element initialization.
  }
}
document.registerElement('x-custom', CustomElement);

相關用法


注:本文由純淨天空篩選整理自dart.dev大神的英文原創作品 Element.created constructor。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。