使用范围:UI2
class ModelBase ($UI/system/lib/base/modelBase)
页面VM
Constructor Top
ModelBase () |
Static Properties & Enumerations Top
ACTIVE_EVENT
= "onActive"
页面激活事件 | |||
INACTIVE_EVENT
= "onInactive"
页面离开事件 | |||
LOAD_EVENT
= "onLoad"
页面加载完事件 | |||
MESSAGE_EVENT
= "onMessage"
页面消息事件 | |||
MODEL_CONSTRUCT_DONE_EVENT
= "onModelConstructDone"
页面模型构造完事件 | |||
MODEL_CONSTRUCT_EVENT
= "onModelConstruct"
页面模型构造前事件 | |||
MODEL_CONSTRUCTING_EVENT
= "onModelConstructing"
页面模型构造中事件,主要用于数据组件加载数据 | |||
MODEL_STATUS_CONSTRUCT
= 1
页面模型构造前 | |||
MODEL_STATUS_CONSTRUCT_DONE
= 3
页面模型构造 | |||
MODEL_STATUS_CONSTRUCTED
= 5
页面模型构造完成 | |||
MODEL_STATUS_CONSTRUCTING
= 2
页面模型构造中 | |||
MODEL_STATUS_LOAD
= 4
页面模型构造Load事件中 | |||
PARAMS_RECEIVE_EVENT
= "onParamsReceive"
接收参数事件 | |||
UNLOAD_EVENT
= "onunLoad"
页面关闭事件 |
Properties Top
OwnerClass |
owner
当前页面的调用者对象 | ||
$UI/system/lib/base/modelBase#Params |
params
参数对象 |
Methods Top
void | addComponent (Element parentElement, Component component, Element targetElement) | |
void | addNode (Element parentElement, Element element, Element targetElement) | |
void |
addNodes
(Element parentElement, List |
|
Object | call (Object caller, Function fn) | |
void | close () | |
Component | comp (Object xidOrNode) | |
Component | componentPromise (Object xidOrNode) | |
Array | comps (String xid) | |
Component | getComponent (Object xidOrNode) | |
Array | getComponents (String xid) | |
Object | getConfig () | |
Context | getContext () | |
String | getContextID () | |
Element | getElementByXid (String xid) | |
Object | getElementsByXid (String xid) | |
String | getIDByXID (String xid) | |
ModelBase | getParent () | |
ModelBase | getParentModel () | |
Element | getRootNode () | |
Integer | getStatus () | |
Boolean | isConctructed () | |
void | postMessage (String message) | |
Object | ref (String col) | |
Component | registerComponent (String xid, Component component) | |
void | removeComponent (Component component) | |
Object | removeElement (Element element) | |
void | removeElementByXid (String xid) | |
void | removeNode (Element element) | |
void | unRegisterComponent (String xid) |
Constructor details
Top
public
ModelBase
()
页面VM
页面VM
Static Properties & Enumerations Detail Top
static
public
ACTIVE_EVENT
= "onActive"
"onActive"
页面激活事件
static
public
INACTIVE_EVENT
= "onInactive"
"onInactive"
页面离开事件
static
public
LOAD_EVENT
= "onLoad"
"onLoad"
页面加载完事件
事件对象的内容如下: { source: this //页面模型 }
static
public
MESSAGE_EVENT
= "onMessage"
"onMessage"
页面消息事件
事件对象的内容如下: { source: this, //页面模型 message: message //消息内容 }
static
public
MODEL_CONSTRUCT_DONE_EVENT
= "onModelConstructDone"
"onModelConstructDone"
页面模型构造完事件
事件对象的内容如下: { source: this //页面模型 }
static
public
MODEL_CONSTRUCT_EVENT
= "onModelConstruct"
"onModelConstruct"
页面模型构造前事件
事件对象的内容如下: { source: this //页面模型 }
static
public
MODEL_CONSTRUCTING_EVENT
= "onModelConstructing"
"onModelConstructing"
页面模型构造中事件,主要用于数据组件加载数据
事件对象的内容如下: { source: this //页面模型 }
static
public
MODEL_STATUS_CONSTRUCT
= 1
1
页面模型构造前
static
public
MODEL_STATUS_CONSTRUCT_DONE
= 3
3
页面模型构造
static
public
MODEL_STATUS_CONSTRUCTED
= 5
5
页面模型构造完成
static
public
MODEL_STATUS_CONSTRUCTING
= 2
2
页面模型构造中
static
public
MODEL_STATUS_LOAD
= 4
4
页面模型构造Load事件中
static
public
PARAMS_RECEIVE_EVENT
= "onParamsReceive"
"onParamsReceive"
接收参数事件
事件对象的内容如下: { source: this, //页面模型 params: data //参数对象 }
static
public
UNLOAD_EVENT
= "onunLoad"
"onunLoad"
页面关闭事件
事件对象的内容如下: { source: this //页面模型 }
Properties Detail Top
当前页面的调用者对象
public
$UI/system/lib/base/modelBase#Params
params
参数对象
Methods Detail Top
添加组件
public
void
addNode
(Element parentElement, Element element, Element targetElement)
添加dom节点
public
void
addNodes
(Element parentElement, List elements, Element targetElement)
添加dom节点
public
Object
call
(Object caller, Function fn)
调用指定的函数
public
void
close
()
关闭当前页面
获取组件
See GetComponent
异步获取组件
public
Array
comps
(String xid)
获取组件
See GetComponents
获取组件
public
Array
getComponents
(String xid)
获取组件
public
Object
getConfig
()
获取当前的配置参数,即.w同名的.json配置
获取上下文
public
String
getContextID
()
获取上下文唯一标识
public
Element
getElementByXid
(String xid)
根据xid获取Element
public
Object
getElementsByXid
(String xid)
根据xid获取Element列表
public
String
getIDByXID
(String xid)
根据xid获取id
获取父VM
获取父VM
public
Element
getRootNode
()
获取当前页面的根节点
public
Integer
getStatus
()
获取页面模型构造状态
See ModelBase.MODEL_STATUS_CONSTRUCT
See ModelBase.MODEL_STATUS_CONSTRUCTING
See ModelBase.MODEL_STATUS_CONSTRUCT_DONE
public
Boolean
isConctructed
()
判断当前页面是否构造完成
public
void
postMessage
(String message)
向VM发送一条消息,触发{$UI/system/lib/base/modelBase.MESSAGE_EVENT}事件
public
Object
ref
(String col)
获取列的值
注册组件实例(只有数据组件需要自己注册)
删除组件
public
Object
removeElement
(Element element)
删除指定的节点
public
void
removeElementByXid
(String xid)
根据xid删除指定的节点
public
void
removeNode
(Element element)
删除dom节点
public
void
unRegisterComponent
(String xid)
取消组件实例(只有数据组件需要自己取消)