Class: Uii

A Base class for all Uii classes

Hierarchy

Constructors

constructor

new Uii(ele, opts?)

Parameters

NameType
elestring | HTMLElement | NodeList | HTMLCollection | (string | HTMLElement)
opts?Record<string, any>

Properties

ele

Protected ele: HTMLElement

处理过的dom元素数组


enabled

Protected enabled: boolean = true


opts

Protected opts: Record<string, any>

当前uii对象的选项

Methods

destroy

destroy(): void

销毁uii对象,包括卸载事件、清空元素等

Returns

void


disable

disable(): void

禁用uii实例,禁用后的dom不会响应事件

Returns

void


enable

enable(): void

启用uii实例

Returns

void


getOption

getOption(): Record<string, any>

获取uii实例选项对象

Returns

Record<string, any>


registerEvent

Protected registerEvent(el, event, hook, useCapture?): void

注册事件,以便在destroy方法中卸载

Parameters

NameTypeDefault valueDescription
elHTMLElementundefineddom元素
eventstringundefined事件名
hookFunctionundefined回调函数
useCapturebooleanfalse默认false

Returns

void


setOption

setOption(name, value): void

设置指定name的选项值。触发onOptionChanged

Parameters

NameType
namestring
valueany

Returns

void


setOptions

setOptions(options?): void

一次设置多个选项值。触发onOptionChanged

Parameters

NameType
options?Record<string, any>

Returns

void