Widget接口 Widget

Widget接口,控件Class完全实现此接口

渲染

render(renderDom)

参数:

NameTypeDescription
renderDomHtmlElement原始html对象

设置属性

set(name, val)

参数:

NameTypeDescription
nameString属性名称
valAny属性值

获取属性

get(name) → {Any}

参数:

NameTypeDescription
nameString属性名称

返回: 属性值

Type Any

绑定事件

on(type, contextopt, callback)

参数:

NameTypeAttributesDescription
typeString事件名称
contextObjectoptional上下文参数,回调函数里可用this.context获取
callbackfunction回调函数

解绑事件

off(type, callback)

参数:

NameTypeDescription
typeString事件名称
callbackfunction回调函数

调用方法

doMethod(name, …arg) → {Any}

参数:

NameTypeAttributesDescription
nameString方法名称
argAny<repeatable>调用参数

返回: 根据方法返回不同值

Type Any

销毁控件

destroy()