Interface DomExtensionMethods

节点拓展方法

interface DomExtensionMethods {
    add: ((child) => Node);
    attr: (<T>(key, value?) => T extends string
        ? Node
        : string);
    create: ((tagName, attr) => Node);
    destroy: (() => Node);
    rect: (() => Record<string, any>);
    setStyle: ((style) => Node);
    [key: string]: any;
}

Indexable

[key: string]: any

其他属性/方法

Properties

add: ((child) => Node)

添加子元素节点

Type declaration

attr: (<T>(key, value?) => T extends string
    ? Node
    : string)

操作属性方法

Type declaration

    • <T>(key, value?): T extends string
          ? Node
          : string
    • Type Parameters

      • T

      Parameters

      • key: string
      • Optional value: T

      Returns T extends string
          ? Node
          : string

create: ((tagName, attr) => Node)

创建并添加子元素节点

Type declaration

    • (tagName, attr): Node
    • Parameters

      • tagName: string
      • attr: Record<string, any>

      Returns Node

destroy: (() => Node)

销毁当前元素节点

Type declaration

rect: (() => Record<string, any>)

获取元素节点在浏览器的数据信息

Type declaration

    • (): Record<string, any>
    • Returns Record<string, any>

setStyle: ((style) => Node)

设置元素节点样式

Type declaration

    • (style): Node
    • Parameters

      • style: Record<string, string>

      Returns Node