new AccordionView()
折叠组件,用于多组件的折叠展开效果,提供水平和垂直两种布局方式
Methods
-
add(title, content, expand, icon)
-
添加组件
Parameters:
Name Type Description title
String 组件的标题文字信息,不同组件不得相同
content
Object | HTMLElement 组件内容,可为HT框架提供的组件对象,也可为原生HTML元素
expand
Boolean 组件是否展开,默认为false
icon
String 组件标题中显示的图标
-
addPropertyChangeListener(listener, scope, ahead)
-
增加自身属性变化事件监听器
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
- See:
-
addViewListener(listener, scope, ahead)
-
监听视图事件,如布局、刷新等
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
-
clear()
-
清除所有组件
-
collapse()
-
合并当前展开的组件
-
expand(title)
-
根据标题找到组件并展开
Parameters:
Name Type Description title
String 标题文字
-
getCollapseIcon() → {String}
-
获取合并图标
Returns:
- Type
- String
-
getCurrentTitle() → {String}
-
获取当前展开组件的标题
Returns:
- Type
- String
-
getExpandIcon() → {String}
-
获取展开图标
Returns:
- Type
- String
-
getHeight() → {Number}
-
获取布局高度
Returns:
- Type
- Number
-
getLabelColor() → {color}
-
获取标题文字颜色
Returns:
- Type
- color
-
getLabelFont() → {String}
-
获取标题文字字体
Returns:
- Type
- String
-
getOrientation() → {String}
-
获取布局方式,默认为vertical或v,可设置为horizontal或h
Returns:
- Type
- String
-
getSelectBackground() → {color}
-
获取标题选中背景色
Returns:
- Type
- color
-
getSelectWidth() → {Number}
-
获取标题选中边框宽度
Returns:
- Type
- Number
-
getSeparatorColor() → {color}
-
获取分割线的颜色
Returns:
- Type
- color
-
getTitleBackground() → {color}
-
获取标题背景色
Returns:
- Type
- color
-
getTitleHeight() → {Number}
-
获取标题高度
Returns:
- Type
- Number
-
getTitles() → {ht.List}
-
获取所有标题
Returns:
- Type
- ht.List
-
getView() → {HTMLDivElement}
-
获取组件的根层div
Returns:
- Type
- HTMLDivElement
-
getWidth() → {Number}
-
获取布局宽度
Returns:
- Type
- Number
-
invalidate(delay)
-
无效组件,并调用延时刷新
Parameters:
Name Type Description delay
Number 延迟刷新的间隔事件(单位:ms)
- See:
-
isDisabled() → {Boolean}
-
组件是否处于不可用状态,处于此状态时不能进行任何操作并且会遮挡一层蒙板
Returns:
- Type
- Boolean
-
isExpanded(title) → {Boolean}
-
判断指定的title是否处于展开状态
Parameters:
Name Type Description title
String 标题文字
Returns:
- Type
- Boolean
-
iv(delay)
-
无效组件,并调用延时刷新
Parameters:
Name Type Description delay
Number 延迟刷新的间隔事件(单位:ms)
- See:
-
mp(listener, scope, ahead)
-
增加自身属性变化事件监听器,addPropertyChangeListener的缩写
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
ahead
Boolean <optional>
是否将当前监听器插入到监听器列表开头
-
onCollapsed(title)
-
合并标题时调用,可重载做后续处理
Parameters:
Name Type Description title
String 标题
-
onExpanded(title)
-
展开标题时调用,可重载做后续处理
Parameters:
Name Type Description title
String 标题
-
remove(title)
-
根据标题找到组件并删除
Parameters:
Name Type Description title
String 标题
-
removePropertyChangeListener(listener, scope)
-
删除自身属性变化事件监听器
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
-
removeViewListener(listener, scope)
-
删除视图事件监听器
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
-
setCollapseIcon(icon)
-
设置合并图标
Parameters:
Name Type Description icon
String 图标
-
setDisabled(value, iconUrl)
-
设置组件是否处于不可用状态,处于不可用状态时不能进行任何操作并且会遮挡一层蒙板
Parameters:
Name Type Argument Description value
Boolean 是否禁用组件
iconUrl
String <optional>
蒙板上显示的icon的路径
-
setExpandIcon(icon)
-
设置展开图标
Parameters:
Name Type Description icon
String 图标
-
setHeight(v)
-
设置布局高度
Parameters:
Name Type Description v
Number 高度值
-
setLabelColor(color)
-
设置标题文字颜色
Parameters:
Name Type Description color
color 颜色值
-
setLabelFont(font)
-
设置标题文字字体
Parameters:
Name Type Description font
String 字体
-
setOrientation(v)
-
设置布局方式,默认为vertical或v,可设置为horizontal或h
Parameters:
Name Type Description v
String 布局方式
-
setSelectBackground(color)
-
设置标题选中背景色
Parameters:
Name Type Description color
color 颜色值
-
setSelectWidth(v)
-
设置标题选中边框宽度
Parameters:
Name Type Description v
Number -
setSeparatorColor(color)
-
设置分割线颜色
Parameters:
Name Type Description color
color 颜色值
-
setTitleBackground(color)
-
设置标题背景色
Parameters:
Name Type Description color
color 颜色值
-
setTitleHeight(v)
-
设置标题高度
Parameters:
Name Type Description v
Number 高度值
-
setWidth(v)
-
设置布局宽度
Parameters:
Name Type Description v
Number 宽度值
-
ump(listener, scope)
-
删除自身属性变化事件监听器,removePropertyChangeListener的缩写
Parameters:
Name Type Argument Description listener
function 监听器函数
scope
Object <optional>
监听器函数域
-
validate()
-
刷新组件