new CheckBox(properties)
复选框组件
样式属性(不含从父类继承):value
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
properties |
any |
<optional> |
Extends
Members
-
_visibleFunc :function
-
- Inherited From:
Methods
-
a(property, value) → {any}
-
Parameters:
Name Type Attributes Description property
any value
any <optional>
Returns:
any- Inherited From:
-
addPropertyChangeListener(listener, scope, ahead) → {void}
-
增加属性事件变化监听函数
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
addStyleProperty(property) → {void}
-
追加样式属性,将参数属性加入到样式属性列表中
Parameters:
Name Type Description property
string 属性名
Returns:
void- Inherited From:
-
addToDOM(dom, rect) → {void}
-
将组件加到页面的 DOM 树中;如果没有任何参数,或者只指定第一个参数并且第一个参数为 window,则组件会填满整个浏览器窗口,
并且浏览器窗口大小变化时也会自动刷新组件Parameters:
Name Type Attributes Description dom
HTMLElement <optional>
指定组件的父亲 DOM,如果为空,则加到 body 中
rect
Object <optional>
组件的范围,格式为 {x: x, y: y, width: width, height: height};如果为空,则填满父亲 DOM
Returns:
void- Inherited From:
-
addViewListener(listener, scope, ahead) → {void}
-
增加 View 事件监听器,如 invalidate(无效事件)、beginValidate 等事件
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
监听器函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
checkPreferredSize(property) → {void}
-
Parameters:
Name Type Description property
string Returns:
void- Inherited From:
-
containsEvent(e) → {boolean}
-
判断交互事件对象位置是否在组件区域
Parameters:
Name Type Description e
UIEvent Returns:
boolean- Inherited From:
-
disableToolTip() → {void}
-
禁用工具提示,同 setToolTipEnabled
Returns:
void- Inherited From:
-
drawBackground(background, x, y, width, height, dom) → {void}
-
绘制背景
Parameters:
Name Type Attributes Description background
ht.ui.drawable.Drawable <optional>
背景 Drawable
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
drawBorder(border, x, y, width, height, dom) → {void}
-
绘制边框
Parameters:
Name Type Attributes Description border
ht.ui.border.Border <optional>
边框对象
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
drawIcon(drawable, x, y, width, height) → {void}
-
绘制图标
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标 Drawable 对象
x
number 绘制范围 x 坐标
y
number 绘制范围 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
Returns:
void- Inherited From:
-
drawText(text, textFont, textColor, x, y, width, height, align, vAlign) → {void}
-
绘制文本
Parameters:
Name Type Description text
string | number | ht.ui.LocaleString 文本内容
textFont
string textColor
string x
number 绘制范围 x 坐标
y
number 绘制范围 y 坐标
width
number 绘制范围的宽度
height
number 绘制范围的高度
align
string vAlign
string Returns:
void- Inherited From:
-
enableToolTip() → {void}
-
启用工具提示,同 setToolTipEnabled
Returns:
void- Inherited From:
-
figureMaxSize() → {Object}
-
计算 maxSize,maxSize 表示组件的最大尺寸,布局器布局时会考虑此尺寸;
Returns:
Object -maxSize
- Inherited From:
-
figureMinSize() → {Object}
-
计算 minSize,minSize 表示组件的最小尺寸,布局器布局时会考虑此尺寸;
Returns:
Object -minSize
- Inherited From:
-
figurePreferredSize() → {Object}
-
计算 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸;
如果自定义组件一般需要重写此函数Returns:
Object -preferredSize
- Inherited From:
-
figureTextSize() → {Object}
-
计算文本尺寸
Returns:
Object -文本尺寸
- Inherited From:
-
fireViewEvent(event) → {void}
-
派发 View 事件
Parameters:
Name Type Description event
string | Object 事件对象;如果是字符串,表示事件类型,函数内自动组装一个事件对象并派发示例:view.fireViewEvent('myevent') 等同于 view.fireViewEvent({kind: 'myevent'})
Returns:
void- Inherited From:
-
fp(property, oldValue, newValue, compareFunc) → {boolean}
-
派发属性变化事件,firePropertyChange 的缩写
Parameters:
Name Type Attributes Description property
string 属性名
oldValue
any 属性变化之前的值
newValue
any 属性变化之后的值
compareFunc
Object <optional>
比较函数,用于比较新值和旧值是否一致,如果一致则不会派发事件
Returns:
boolean -事件是否派发成功
- Inherited From:
-
getActiveBackground() → {any}
-
获取 active 状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getActiveBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 active 状态下背景的 Drawable 对象
- Inherited From:
-
getActiveBorder() → {ht.ui.border.Border}
-
获取 active 状态下的边框
- Inherited From:
-
getActiveIcon() → {any}
-
获取 active 状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getActiveIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 active 状态下的图标的 Drawable 对象
- Inherited From:
-
getActiveTextColor() → {string}
-
获取 active 状态下文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getAlign() → {string}
-
获取文字和图标在按钮水平方向的整体对齐方式,默认为 'center'
Returns:
string -对齐方式,可选值为 'left'|'right'|'center'
- Inherited From:
-
getAttr(property) → {any}
-
Parameters:
Name Type Description property
string Returns:
any- Inherited From:
-
getBackground() → {any}
-
获取组件的背景,可以是颜色或者图片等
Returns:
any -组件背景
- Inherited From:
-
getBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取组件背景的 Drawable 对象
- Inherited From:
-
getBadge() → {any}
-
获取 badge 信息
Returns:
any -badge 信息
- Inherited From:
-
getBorder() → {ht.ui.border.Border}
-
获取组件的边框
- Inherited From:
-
getBorderBottom() → {number}
-
获取组件边框的底部高度
Returns:
number -组件边框底部高度
- Inherited From:
-
getBorderLeft() → {number}
-
获取组件边框的左侧宽度
Returns:
number -组件边框左侧宽度
- Inherited From:
-
getBorderRadius() → {number|Array.<number>}
-
获取 CSS 边框圆角
Returns:
number | Array.<number> -边框圆角
- Inherited From:
-
getBorderRight() → {number}
-
获取组件边框的右侧宽度
Returns:
number -组件边框右侧宽度
- Inherited From:
-
getBorderTop() → {number}
-
获取组件边框的顶部高度
Returns:
number -组件边框顶部高度
- Inherited From:
-
getBoxShadow() → {string}
-
获取 CSS 阴影值
Returns:
string -阴影值
- Inherited From:
-
getClassName() → {string}
-
获取类名
Returns:
string- Inherited From:
-
getColorMode() → {string}
-
Returns:
string- Inherited From:
-
getContentBottom() → {number}
-
获取内容底部距离,即底部边框高度加底部内边距高度
Returns:
number -内容底部距离
- Inherited From:
-
getContentDiv() → {HTMLElement}
-
获取内容 div;对于普通组件,contentDiv 里放置了 canvas 画布;对于容器组件,contentDiv 里除了画布,还有所有的子组件
Returns:
HTMLElement -内容 div
- Inherited From:
-
getContentHeight() → {number}
-
获取内容高度,即组件高度减去边框高度和上下内边距高度
Returns:
number -内容高度
- Inherited From:
-
getContentLeft() → {number}
-
获取内容左侧距离,即左侧边框宽度加左侧内边距宽度
Returns:
number -内容左侧距离
- Inherited From:
-
getContentPoint(event) → {Object}
-
获取内容坐标点;此坐标与内边距和边框无关,是从内容区域左上角开始计算
Parameters:
Name Type Description event
any 交互事件对象(如鼠标事件对象)
Returns:
Object -内容坐标点,包含 x、y 坐标
- Inherited From:
-
getContentRight() → {number}
-
获取内容右侧距离,即右侧边框宽度加右侧内边距宽度
Returns:
number -内容右侧距离
- Inherited From:
-
getContentTop() → {number}
-
获取内容顶部距离,即顶部边框高度加顶部内边距高度
Returns:
number -内容顶部距离
- Inherited From:
-
getContentWidth() → {number}
-
获取内容宽度,即组件宽度减去边框宽度和左右内边距宽度
Returns:
number -内容宽度
- Inherited From:
-
getContextMenu() → {ht.ui.ContextMenu}
-
获取绑定的右键菜单
- Inherited From:
-
getCurrentBackgroundDrawable(state) → {ht.ui.drawable.Drawable}
-
获取背景的 Drawable 对象;此函数根据当前按钮的状态(normal、hover、active、disabled) 返回相应的背景,如:hover 状态下返回 getHoverBackgroundDrawable()
Parameters:
Name Type Attributes Description state
string <optional>
状态,如果未指定,使用 button.getState()
- Inherited From:
-
getCurrentIconDrawable(state) → {ht.ui.drawable.Drawable}
-
获取图标的 Drawable 对象;此函数根据当前按钮的状态(normal、hover、active、disabled) 返回相应的 Drawable,如:hover 状态下返回 getHoverIconDrawable()
Parameters:
Name Type Attributes Description state
string <optional>
状态,如果未指定,使用 button.getState()
- Inherited From:
-
getCurrentTextColor(state) → {string}
-
获取文字颜色;此函数根据当前按钮的状态(normal、hover、active、disabled) 返回相应的文本颜色,如:hover 状态下返回 getHoverTextColor()
Parameters:
Name Type Attributes Description state
string <optional>
状态,如果未指定,使用 button.getState()
Returns:
string -文字颜色
- Inherited From:
-
getCursor() → {string}
-
获取鼠标样式(CSS 格式)
Returns:
string -鼠标样式
- Inherited From:
-
getDisabledBackground() → {any}
-
获取 disabled 状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getDisabledBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 disabled 状态下背景的 Drawable 对象
- Inherited From:
-
getDisabledBorder() → {ht.ui.border.Border}
-
获取 disabled 状态下的边框
- Inherited From:
-
getDisabledIcon() → {any}
-
获取 disabled 状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getDisabledIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 disabled 状态下的图标的 Drawable 对象
- Inherited From:
-
getDisabledTextColor() → {string}
-
获取 disabled 状态下文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getDOMProperties() → {any}
-
获取 DOM 属性映射表,格式为:{'width': true ...};这些属性发生变化才会更新 DOM 结构,否则只需要绘制内容即可
Returns:
any -DOM 属性映射表
- Inherited From:
-
getErrorMessage() → {string}
-
获取错误信息
Returns:
string -错误信息
- Inherited From:
-
getFormDataName() → {string}
-
获取组件在表单中的名称
Returns:
string -名称
- Inherited From:
-
getFormDataProperties() → {any}
-
获取影响表单值的属性映射表;这些属性发生变化会使表单工具重新从此组件取值
Returns:
any -属性映射表
- Inherited From:
-
getFormDataValue() → {any}
-
获取组件在表单中的值
Returns:
any -值
- Inherited From:
-
getHeight() → {number}
-
获取组件的高度
Returns:
number -组件高度
- Inherited From:
-
getHoverBackground() → {any}
-
获取 hover 状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getHoverBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 hover 状态下背景的 Drawable 对象
- Inherited From:
-
getHoverBorder() → {ht.ui.border.Border}
-
获取 hover 状态下的边框
- Inherited From:
-
getHoverIcon() → {any}
-
获取 hover 状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getHoverIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 hover 状态下的图标的 Drawable 对象
- Inherited From:
-
getHoverTextColor() → {string}
-
获取 hover 状态下文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getHTextPosition() → {string}
-
获取文字在水平方向相对于图标的位置,默认值为 'right'
Returns:
string -位置,可选值为 'left'|'right'|'center'
- Inherited From:
-
getIcon() → {any}
-
获取图标,可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getIconDrawable() → {ht.ui.drawable.Drawable}
-
获取图标的 Drawable 对象
- Inherited From:
-
getIconHeight() → {number}
-
获取图标的高度
Returns:
number -图标高度
- Inherited From:
-
getIconStretch() → {string}
-
获取图标拉伸方式
Returns:
string -图标拉伸方式
- Inherited From:
-
getIconTextGap() → {number}
-
获取图标和文字之间的间距
Returns:
number -间距值
- Inherited From:
-
getIconTint() → {string}
-
获取图标染色
Returns:
string- Inherited From:
-
getIconWidth() → {number}
-
获取图标的宽度
Returns:
number -图标宽度
- Inherited From:
-
getId() → {any}
-
获取唯一标识,根据标识可快速查找到组件
Returns:
any -唯一标识
- Inherited From:
-
getInteractorClasses() → {Array.<string>}
-
获取交互器类名数组
Returns:
Array.<string> -交互器类名数组
- Inherited From:
-
getLayoutParams(key) → {any}
-
获取布局参数
Parameters:
Name Type Attributes Description key
string <optional>
布局参数中的 key
Returns:
any -如果指定 key 参数返回布局参数中 key 对应的值,否则返回整个布局参数对象
- Inherited From:
-
getMargin() → {number|Array.<number>}
-
获取组件外边距,如果是数字,说明四边使用相同的外边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Returns:
number | Array.<number> -外边距
- Inherited From:
-
getMarginBottom() → {number}
-
获取组件底部外边距高度
Returns:
number -底部外边距高度
- Inherited From:
-
getMarginRight() → {number}
-
获取组件右侧外边距宽度
Returns:
number -右侧外边距宽度
- Inherited From:
-
getMarginTop() → {number}
-
获取组件顶部外边距高度
Returns:
number -顶部外边距高度
- Inherited From:
-
getMarignLeft() → {number}
-
获取组件左侧外边距宽度
Returns:
number -左侧外边距宽度
- Inherited From:
-
getMatchedStyles() → {any}
-
获取组件匹配到的样式
Returns:
any- Inherited From:
-
getMaxSize() → {Object}
-
获取 maxSize,maxSize 表示组件自身最合适的尺寸;
如果用户没有设置,则调用 figureMaxSize 计算Returns:
Object -maxSize
- Inherited From:
-
getMaxSizeProperties() → {any}
-
获取 maxSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 maxSize
Returns:
any -maxSize 属性映射表
- Inherited From:
-
getMinSize() → {Object}
-
获取 minSize,minSize 表示组件的最小尺寸;
如果用户没有设置,则调用 figureMinSize 计算Returns:
Object -minSize
- Inherited From:
-
getMinSizeProperties() → {any}
-
获取 minSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 minSize
Returns:
any -minSize 属性映射表
- Inherited From:
-
getMultilineTextAlign() → {string}
-
获取多行文本中每行文字的对齐方式
Returns:
string -对齐方式,可选值为 'left'|'right'|'center'
- Inherited From:
-
getPadding() → {number|Array.<number>}
-
获取组件内边距,如果是数字,说明四边使用相同的内边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Returns:
number | Array.<number> -内边距
- Inherited From:
-
getPaddingBottom() → {number}
-
获取组件底部内边距高度
Returns:
number -底部内边距高度
- Inherited From:
-
getPaddingLeft() → {number}
-
获取组件左侧内边距宽度
Returns:
number -左侧内边距宽度
- Inherited From:
-
getPaddingRight() → {number}
-
获取组件右侧内边距宽度
Returns:
number -右侧内边距宽度
- Inherited From:
-
getPaddingTop() → {number}
-
获取组件顶部内边距高度
Returns:
number -顶部内边距高度
- Inherited From:
-
getParent() → {ht.ui.ViewGroup}
-
获取父容器
- Inherited From:
-
getPopover() → {ht.ui.Popover}
-
获取弹框组件
- Inherited From:
-
getPopoverPlacements() → {Array.<string>}
-
获取弹框组件的弹出位置
Returns:
Array.<string> -弹出位置
- Inherited From:
-
getPopoverTrigger() → {string}
-
获取弹框触发器
Returns:
string -弹框触发器,值为:click|hover
- Inherited From:
-
getPreferredSize() → {Object}
-
获取 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸;
如果用户没有设置,则调用 figurePreferredSize 计算Returns:
Object -preferredSize
- Inherited From:
-
getPreferredSizeProperties() → {any}
-
获取 preferredSize 属性映射表,格式为:{'border': true ...};这些属性变化会重新计算 preferredSize
Returns:
any -preferredSize 属性映射表
- Inherited From:
-
getPropertyValue(name) → {any}
-
取组件的某个属性的原始值;
不要直接去取私有变量,例如 padding,不要直接取 _padding 私有变量,而是应该使用此函数取值;
此函数取值顺序:
先取 _padding 私有变量
如果为 undefind,再去取样式表中取值
如果为 undefied,再取 __padding 私有变量Parameters:
Name Type Description name
string 属性名
Returns:
any -属性值
- Inherited From:
Example
// 这段代码演示了覆盖 getPadding 函数,先取出旧的 padding,再 +2 并返回 button.getPadding = function() { var oldPadding = this.getPropertyValue('padding'); oldPadding += 2; return oldPadding; }
-
getRadios() → {ht.ui.Radios}
-
获取单选控制器
- Inherited From:
-
getRootCanvas() → {HTMLCanvasElement}
-
获取根 Canvas,这个 Canvas 用来绘制背景、边框、内容等
Returns:
HTMLCanvasElement -Canvas DOM 对象
- Inherited From:
-
getRootContext(dom, ignoreCache) → {CanvasRenderingContext2D}
-
获取默认的 canvas 画布的画笔对象,或者获取参数 DOM 对象的画笔;
此函数在绘制背景、边框和自定义组件的情况下经常使用Parameters:
Name Type Attributes Description dom
HTMLElement <optional>
指定目标 DOM,通常是个 canvas 类型的 DOM 对象
ignoreCache
boolean <optional>
Returns:
CanvasRenderingContext2D -画笔对象
- Inherited From:
-
getSelectActiveBackground() → {any}
-
获取 active 选中状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getSelectActiveBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 active 选中状态下背景的 Drawable 对象
- Inherited From:
-
getSelectActiveBorder() → {ht.ui.border.Border}
-
获取 active 选中状态下边框
Returns:
ht.ui.border.Border- Inherited From:
-
getSelectActiveIcon() → {any}
-
获取 active 选中状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getSelectActiveIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 active 选中状态下的图标的 Drawable 对象
- Inherited From:
-
getSelectActiveTextColor() → {string}
-
获取 active 选中状态下文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getSelectBackground() → {any}
-
获取正常选中状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getSelectBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取正常选中状态下背景的 Drawable 对象
- Inherited From:
-
getSelectBorder() → {ht.ui.border.Border}
-
获取正常选中状态下边框
Returns:
ht.ui.border.Border- Inherited From:
-
getSelectDisabledBackground() → {any}
-
获取 disabled 选中状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getSelectDisabledBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 disabled 选中状态下背景的 Drawable 对象
- Inherited From:
-
getSelectDisabledBorder() → {ht.ui.border.Border}
-
获取 active 选中状态下边框
Returns:
ht.ui.border.Border- Inherited From:
-
getSelectDisabledIcon() → {any}
-
获取 disabled 选中状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getSelectDisabledIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 disabled 选中状态下的图标的 Drawable 对象
- Inherited From:
-
getSelectDisabledTextColor() → {string}
-
获取 active 选中状态下文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getSelectHoverBackground() → {any}
-
获取 hover 选中状态下的背景;可以是颜色或者图片等
Returns:
any -背景
- Inherited From:
-
getSelectHoverBackgroundDrawable() → {ht.ui.drawable.Drawable}
-
获取 hover 选中状态下背景的 Drawable 对象
- Inherited From:
-
getSelectHoverBorder() → {ht.ui.border.Border}
-
获取 hover 选中状态下边框
Returns:
ht.ui.border.Border- Inherited From:
-
getSelectHoverIcon() → {any}
-
获取 hover 选中状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getSelectHoverIconDrawable() → {ht.ui.drawable.Drawable}
-
获取 hover 选中状态下的图标的 Drawable 对象
- Inherited From:
-
getSelectHoverTextColor() → {string}
-
获取 hover 选中状态下文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getSelectIcon() → {any}
-
获取正常选中状态下的图标;可以是颜色或者图片等
Returns:
any -图标
- Inherited From:
-
getSelectIconDrawable() → {ht.ui.drawable.Drawable}
-
获取正常选中状态下图标的 Drawable 对象
- Inherited From:
-
getSelectTextColor() → {string}
-
获取正常选中状态下文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getState() → {string}
-
获取按钮状态
Returns:
string -按钮状态,值可能为:'normal'|'hover'|'active'
- Inherited From:
-
getStyle(property) → {any}
-
Parameters:
Name Type Description property
string Returns:
any- Inherited From:
-
getStyleProperties() → {any}
-
获取样式属性映射表,格式为:{'padding': true, 'border': true ...}
Returns:
any -样式属性映射表
- Inherited From:
-
getStyleValue(property) → {any}
-
获取样式属性对应的样式值
Parameters:
Name Type Description property
string 属性名
Returns:
any -样式值
- Inherited From:
-
getText() → {string}
-
获取文字内容
Returns:
string -文字内容
- Inherited From:
-
getTextColor() → {string}
-
获取文字颜色
Returns:
string -文字颜色
- Inherited From:
-
getTextFont() → {string}
-
获取文字字体
Returns:
string -文字字体
- Inherited From:
-
getTextSize() → {Object}
-
返回计算出来的文本尺寸,可重写返回自定义的尺寸
Returns:
Object -尺寸对象,格式为 { width: width, height: height }
- Inherited From:
-
getToolTip(event) → {string}
-
获取工具提示文本内容
Parameters:
Name Type Attributes Description event
any <optional>
Returns:
string -工具提示文本内容
- Inherited From:
-
getVAlign() → {string}
-
获取文字和图标在按钮垂直方向的整体对齐方式,默认为 'middle'
Returns:
string -对齐方式,可选值为 'top'|'bottom'|'middle'
- Inherited From:
-
getValue() → {any}
-
获取组件值;此值可以放置业务属性
Returns:
any -组件值
- Inherited From:
-
getView() → {HTMLElement}
-
获取组件最根层的 div
Returns:
HTMLElement -组件 div
- Inherited From:
-
getViewPoint(event) → {Object}
-
获取组件坐标点;从组件的左上角开始计算
Parameters:
Name Type Description event
any 交互事件对象(如鼠标事件对象)
Returns:
Object -组件坐标点,包含 x、y 坐标
- Inherited From:
-
getVTextPosition() → {string}
-
获取文字在垂直方向相对于图标的位置,默认值为 'middle'
Returns:
string -位置,可选值为 'top'|'bottom'|'middle'
- Inherited From:
-
getWidth() → {number}
-
获取组件的宽度
Returns:
number -组件宽度
- Inherited From:
-
getX() → {number}
-
获取组件的 x 坐标
Returns:
number -x 坐标
- Inherited From:
-
getY() → {number}
-
获取组件的 y 坐标
Returns:
number -y 坐标
- Inherited From:
-
getZIndex() → {number}
-
获取组件的堆叠顺序
Returns:
number -堆叠顺序
- Inherited From:
-
getZoom() → {number}
-
获取缩放值
Returns:
number -缩放值
- Inherited From:
-
getZoomAnchor() → {Array.<number>}
-
获取缩放锚点
Returns:
Array.<number> -锚点数组
- Inherited From:
-
hasContentCanvas() → {boolean}
-
判断组件是否有私有 canvas
Returns:
boolean -组件是否有私有 canvas
- Inherited From:
-
hasFocus() → {boolean}
-
判断焦点是否在组件上
Returns:
boolean -焦点是否在组件上
- Inherited From:
-
hidePopover() → {void}
-
隐藏弹框组件
Returns:
void- Inherited From:
-
hideToolTip() → {void}
-
隐藏 toolTip
Returns:
void- Inherited From:
-
hitTest(event) → {void}
-
判断是否点击中按钮,可重写此函数实现特殊形状按钮的交互
Parameters:
Name Type Description event
any 事件对象
Returns:
void- Inherited From:
-
initView(canvas) → {void}
-
初始化组件的 DOM 结构
Parameters:
Name Type Attributes Description canvas
boolean <optional>
是否创建一个私有的 canvas 用来绘制私有内容,一般情况下在默认的 canvas 中绘制就可以,不需要此参数
Returns:
void- Inherited From:
-
invalidate(forceLayoutChildren) → {void}
-
使组件无效化
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
invalidateDOM() → {void}
-
设置重新布局 DOM 标记并调用 invalidate, 组件下次刷新时会强制更新 DOM
Returns:
void- Inherited From:
-
isDescendantOf(viewGroup) → {boolean}
-
判断当前组件是否是参数容器的子孙组件
Parameters:
Name Type Description viewGroup
ht.ui.ViewGroup 容器
Returns:
boolean- Inherited From:
-
isDisabled() → {boolean}
-
组件是否被禁用
Returns:
boolean -是否被禁用
- Inherited From:
-
isFloatLayout() → {boolean}
-
Returns:
boolean- Inherited From:
-
isFocusable() → {boolean}
-
组件是否可以获取焦点
Returns:
boolean -是否可获取焦点
- Inherited From:
-
isInDOM() → {boolean}
-
判断组件是否在 DOM 树中
Returns:
boolean -组件是否在 DOM 树中
- Inherited From:
-
isMaxSizeSet() → {boolean}
-
判断 maxSize 是否被设置(如果为 true, 组件不再调用 figureMaxSize 自动计算)
Returns:
boolean -maxSize 是否被设置
- Inherited From:
-
isMinSizeSet() → {boolean}
-
判断 minSize 是否被设置(如果为 true, 组件不再调用 figureMinSize 自动计算)
Returns:
boolean -minSize 是否被设置
- Inherited From:
-
isPixelPerfect() → {boolean}
-
点击时是否根据像素点判断
Returns:
boolean- Inherited From:
-
isPreferredSizeSet() → {boolean}
-
判断 preferredSize 是否被设置(如果为 true, 组件不再调用 figurePreferredSize 自动计算)
Returns:
boolean -preferredSize 是否被设置
- Inherited From:
-
isRedrawOnFocus() → {boolean}
-
判断组件获取或失去焦点时,是否重绘自身
Returns:
boolean -是否重绘自身
- Inherited From:
-
isSelected() → {boolean}
-
判断组件是否处于选中状态
Returns:
boolean -是否选中
- Inherited From:
-
isSelfViewEvent(event) → {boolean}
-
判断鼠标事件是否发生在组件自身上,例如容器的 div 上监听到一个原生的鼠标点击事件,此事件可能来自容器,也可能来自子组件的冒泡传播;
如果自定义组件,并且改变了组件的 DOM 结构,需要重写此函数Parameters:
Name Type Description event
any 事件对象
Returns:
boolean -事件是否发生在自身 DOM 上
- Inherited From:
-
isStyleProperty(property) → {boolean}
-
判断属性是否是样式属性
Parameters:
Name Type Description property
string 属性名
Returns:
boolean -是否是样式属性
- Inherited From:
-
isToolTipEnabled() → {boolean}
-
是否启用工具提示
Returns:
boolean -是否启用工具提示
- Inherited From:
-
isVisible() → {boolean}
-
判断组件是否可见
Returns:
boolean -组件是否可见
- Inherited From:
-
iv(forceLayoutChildren) → {void}
-
使组件无效化
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
layoutDOM(x, y, width, height) → {void}
-
重新调整组件的 DOM 结构布局,设置坐标、宽高以及内边距等
Parameters:
Name Type Attributes Description x
number 组件的 x 坐标
y
number <optional>
组件的 y 坐标
width
number <optional>
组件宽度
height
number <optional>
组件高度
Returns:
void- Inherited From:
-
makeDisabled(disabled, disabledDiv) → {void}
-
设置禁用组件样式,默认会将 disabedDiv 插入到组件内部
Parameters:
Name Type Description disabled
boolean 是否禁用
disabledDiv
HTMLElement 遮罩 div
Returns:
void- Inherited From:
-
mp(listener, scope, ahead) → {void}
-
增加属性事件变化监听函数,addPropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
ahead
boolean <optional>
是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
off(name, listener, scope) → {void}
-
删除事件监听
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
Returns:
void- Inherited From:
-
on(name, listener, scope, ahead) → {void}
-
增加事件监听
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听的是属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
ahead
boolean <optional>
如果是 DOM 事件,表示 useCapture;否则表示是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
onOnce(name, listener, scope, ahead) → {void}
-
增加一次性事件监听(监听器执行一次,然后马上被删除)
Parameters:
Name Type Attributes Description name
string 属性名,p: 开头(如 p:value),表示监听属性变化事件;d: 开头(如 d:mousedown) 表示监听原生 DOM 事件;其它情况当作 viewEvent 处理
listener
Object scope
any <optional>
监听器函数域
ahead
boolean <optional>
如果是 DOM 事件,表示 useCapture;否则表示是否将当前监听器插入到监听器列表开头
Returns:
void- Inherited From:
-
onPropertyChanged(e) → {void}
-
属性变化回调
Parameters:
Name Type Description e
Object Returns:
void- Inherited From:
-
processValidate() → {void}
-
绘制组件边框、背景及调用 validateImpl;此函数在 validate 中被调用
Returns:
void- Inherited From:
-
redraw(forceLayoutChildren) → {void}
-
设置所有的重绘标记包括重绘 canvas 标记、重绘 border 标记和重新布局 DOM 标记 并调用 iv
Parameters:
Name Type Attributes Description forceLayoutChildren
boolean <optional>
是否强制刷新子组件(即使子组件没有无效标记)
Returns:
void- Inherited From:
-
removeFromDOM() → {void}
-
将组件从页面的 DOM 树中删除;如果要删除通过 addToDOM 添加到页面的组件,应使用此函数,以免内存泄漏
Returns:
void- Inherited From:
-
removePropertyChangeListener(listener, scope) → {void}
-
删除属性事件变化监听器
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
Returns:
void- Inherited From:
-
removeStyleProperty(property) → {void}
-
删除样式属性,将参数属性从样式属性列表中移除
Parameters:
Name Type Description property
string 属性名
Returns:
void- Inherited From:
-
removeViewListener(listener, scope) → {void}
-
删除 View 事件监听器
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
监听器函数域
Returns:
void- Inherited From:
-
requestFocus() → {void}
-
请求获取焦点
Returns:
void- Inherited From:
-
resetTranslate() → {any}
-
Returns:
any- Inherited From:
-
set(properties) → {void}
-
批量设置组件属性
Parameters:
Name Type Description properties
any 格式示范:{ background: 'red', border: new ht.ui.border.LineBorder(1, 'red'), padding: 20 }
Returns:
void- Inherited From:
-
setActiveBackground(background) → {void}
-
设置 active 状态下的背景
Parameters:
Name Type Description background
any 背景;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveBackgroundDrawable(drawable) → {void}
-
设置 active 状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setActiveBorder(border) → {void}
-
设置 active 状态下的边框
Parameters:
Name Type Description border
ht.ui.border.Border 组件边框
Returns:
void- Inherited From:
-
setActiveIcon(icon) → {void}
-
设置 active 状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setActiveIconDrawable(drawable) → {void}
-
设置 active 状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setActiveIconTint(color) → {void}
-
Parameters:
Name Type Description color
string Returns:
void- Inherited From:
-
setActiveTextColor(color) → {void}
-
设置 active 状态下文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setAlign(align) → {void}
-
设置文字和图标在按钮水平方向的整体对齐方式,默认为 'center'
Parameters:
Name Type Description align
string 对齐方式,可选值为 'left'|'right'|'center'
Returns:
void- Inherited From:
-
setAttr(property, value) → {void}
-
Parameters:
Name Type Description property
string value
any Returns:
void- Inherited From:
-
setBackground(background) → {void}
-
设置组件的背景,可以是颜色或者图片等;此值最终会被转换为 Drawable 对象
Parameters:
Name Type Description background
any 颜色值、图片名、图片路径、矢量对象等
Returns:
void- Inherited From:
-
setBackgroundDrawable(drawable) → {void}
-
设置组件的背景 Drawable 对象;组件渲染时优先使用此 Drawable 对象,如果为空,再用 background 转换
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable Drawable 对象
Returns:
void- Inherited From:
-
setBadge(badge) → {void}
-
设置 badge 信息
Parameters:
Name Type Description badge
any badge 信息,值为字符串时被作为 badge 文字;也可以指定一个对象:{ text: '1', css: { borderRadius: '10px' } },其中 text 属性为 badge 文字提示,css 属性为 CSS 样式(背景、边框、位置等)
Returns:
void- Inherited From:
-
setBorder(border) → {void}
-
设置组件的边框
Parameters:
Name Type Description border
ht.ui.border.Border 组件边框
Returns:
void- Inherited From:
-
setBorderRadius(radius) → {void}
-
设置 CSS 边框圆角
Parameters:
Name Type Description radius
number | Array.<number> 边框圆角;如果是数组,则表示[左上角圆角、右上角圆角、右下角圆角、左下角圆角]
Returns:
void- Inherited From:
-
setBoxShadow(boxShadow) → {void}
-
设置 CSS 阴影值
Parameters:
Name Type Description boxShadow
string 阴影值
Returns:
void- Inherited From:
-
setColorMode(mode) → {void}
-
Parameters:
Name Type Description mode
string Returns:
void- Inherited From:
-
setContextMenu(contextMenu) → {void}
-
设置绑定的右键菜单
Parameters:
Name Type Description contextMenu
ht.ui.ContextMenu 右键菜单
Returns:
void- Inherited From:
-
setCursor(cursor) → {void}
-
设置鼠标样式(CSS 格式)
Parameters:
Name Type Description cursor
string 鼠标样式
Returns:
void- Inherited From:
-
setDisabled(disabled) → {void}
-
设置组件是否被禁用
Parameters:
Name Type Description disabled
string | boolean 是否被禁用;如果为字符串,组件除了被禁用,disabledDiv 还会被设置相应的 CSS 样式名
Returns:
void- Inherited From:
-
setDisabledBackground(background) → {void}
-
设置 disabled 状态下的背景
Parameters:
Name Type Description background
any 背景;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setDisabledBackgroundDrawable(drawable) → {void}
-
设置 disabled 状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setDisabledBorder(border) → {void}
-
设置 disabled 状态下的边框
Parameters:
Name Type Description border
ht.ui.border.Border 组件边框
Returns:
void- Inherited From:
-
setDisabledIcon(icon) → {void}
-
设置 disabled 状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setDisabledIconDrawable(drawable) → {void}
-
设置 disabled 状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setDisabledTextColor(color) → {void}
-
设置 disabled 状态下文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setErrorMessage(message, params) → {ht.ui.Popover}
-
设置错误信息
Parameters:
Name Type Description message
string 错误信息
params
any ErrorMessagePopover 组件的属性配置,如 { placements: ['top'] } 将错误提示显示在上方
- Inherited From:
-
setFloatLayout(floatLayout) → {void}
-
Parameters:
Name Type Description floatLayout
boolean Returns:
void- Inherited From:
-
setFocusable(focusable) → {void}
-
设置组件是否可以获取焦点
Parameters:
Name Type Description focusable
boolean 是否可获取焦点
Returns:
void- Inherited From:
-
setFormDataName(name) → {void}
-
设置组件在表单中的名称
Parameters:
Name Type Description name
string 名称
Returns:
void- Inherited From:
-
setHeight(height) → {void}
-
设置组件的高度
Parameters:
Name Type Description height
number 组件高度
Returns:
void- Inherited From:
-
setHoverBackground(background) → {void}
-
设置 hover 状态下的背景
Parameters:
Name Type Description background
any 背景;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverBackgroundDrawable(drawable) → {void}
-
设置 hover 状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setHoverBorder(border) → {void}
-
设置 hover 状态下的边框
Parameters:
Name Type Description border
ht.ui.border.Border 组件边框
Returns:
void- Inherited From:
-
setHoverIcon(icon) → {void}
-
设置 hover 状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setHoverIconDrawable(drawable) → {void}
-
设置 hover 状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setHoverIconTint(color) → {void}
-
Parameters:
Name Type Description color
string Returns:
void- Inherited From:
-
setHoverTextColor(color) → {void}
-
设置 hover 状态下文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setHTextPosition(position) → {void}
-
设置文字在水平方向相对于图标的位置,默认值为 'right'
Parameters:
Name Type Description position
string 位置,可选值为 'left'|'right'|'center'
Returns:
void- Inherited From:
-
setIcon(icon) → {void}
-
设置图标,可以是颜色或者图片等
Parameters:
Name Type Description icon
any 图标,可以是颜色值、图片名、图片路径、矢量对象等
Returns:
void- Inherited From:
-
setIconDrawable(drawable) → {void}
-
设置图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setIconHeight(height) → {void}
-
设置图标的高度
Parameters:
Name Type Description height
number 图标高度
Returns:
void- Inherited From:
-
setIconStretch(stretch) → {void}
-
设置图标拉伸方式
Parameters:
Name Type Description stretch
string Returns:
void- Inherited From:
-
setIconTextGap(gap) → {void}
-
设置图标和文字之间的间距
Parameters:
Name Type Description gap
number 间距值
Returns:
void- Inherited From:
-
setIconTint(color) → {void}
-
设置图标染色
Parameters:
Name Type Description color
string Returns:
void- Inherited From:
-
setIconWidth(width) → {void}
-
设置图标的宽度
Parameters:
Name Type Description width
number 图标宽度
Returns:
void- Inherited From:
-
setId(id) → {void}
-
设置唯一标识,根据标识可快速查找到组件
Parameters:
Name Type Description id
string | number 唯一标识
Returns:
void- Inherited From:
-
setLayoutParams(layoutParams, value) → {void}
-
设置布局参数;这个函数有两种使用方式:
view.setLayoutParams({ marginLeft: 20, marginRight: 20 }) 指定布局参数对象
view.setLayoutParams('marginLeft', 20) 传入两个参数设置布局参数对象中的属性Parameters:
Name Type Attributes Description layoutParams
any <optional>
布局参数对象或 key
value
any <optional>
布局参数值
Returns:
void- Inherited From:
-
setLoading(arg0) → {void}
-
Parameters:
Name Type Description arg0
boolean Returns:
void- Inherited From:
-
setMargin(margin) → {void}
-
设置组件外边距,如果是数字,说明四边使用相同的外边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Parameters:
Name Type Description margin
number | Array.<number> 外边距;父容器布局时,会动态将此参数填充到 layoutParams 中(优先级低于 layoutParams,如果 layoutParams 参数中没有指定相应的 margin 才会从组件上取值)
Returns:
void- Inherited From:
-
setMaxSize(width, height) → {void}
-
Parameters:
Name Type Attributes Description width
number <optional>
height
number <optional>
Returns:
void- Inherited From:
-
setMemoryValidate(validate) → {void}
-
Parameters:
Name Type Description validate
boolean Returns:
void- Inherited From:
-
setMinSize(width, height) → {void}
-
Parameters:
Name Type Attributes Description width
number <optional>
height
number <optional>
Returns:
void- Inherited From:
-
setMultilineTextAlign(align) → {void}
-
设置多行文本中每行文字的对齐方式
Parameters:
Name Type Description align
string 对齐方式,可选值为 'left'|'right'|'center'
Returns:
void- Inherited From:
-
setPadding(padding) → {void}
-
设置组件内边距,如果是数字,说明四边使用相同的内边距;如果是数组,则格式为:[上边距, 右边距, 下边距, 左边距]
Parameters:
Name Type Description padding
number | Array.<Number> 内边距
Returns:
void- Inherited From:
-
setPixelPerfect(pixelPerfect) → {void}
-
设置点击时是否根据像素点判断
Parameters:
Name Type Description pixelPerfect
boolean 如果为 true,只有点击的位置有像素点时才被认为点击中
Returns:
void- Inherited From:
-
setPopover(popover, trigger) → {void}
-
设置弹框组件
Parameters:
Name Type Attributes Description popover
string | ht.ui.Popover 弹框组件,如果参数是字符串,则用这段文本作为弹框内容(内部自动创建 Popover 和 HtmlView 组件)
trigger
string <optional>
触发器,值为:click|hover
Returns:
void- Inherited From:
-
setPopoverPlacements(placements) → {void}
-
设置弹框组件的弹出位置
Parameters:
Name Type Description placements
Array.<string> 位置数组
Returns:
void- Inherited From:
-
setPopoverTrigger(trigger) → {void}
-
设置弹框触发器
Parameters:
Name Type Description trigger
string 弹框触发器,值为:click|hover
Returns:
void- Inherited From:
-
setPreferredSize(width, height) → {void}
-
设置 preferredSize,preferredSize 表示组件自身最合适的尺寸,布局器布局时会考虑此尺寸作为布局尺寸;
如果设置过 preferredSize,就不会再调用 figurePreferredSize 计算;
如果要清空设置过的 preferredSize,可以调用 setPreferredSize(undefined, undefined);Parameters:
Name Type Attributes Description width
number | Size2d <optional>
首选宽度
height
number <optional>
首选高度
Returns:
void- Inherited From:
-
setPropertyValue(name, value) → {void}
-
设置属性值并派发事件,自定义 set 函数内部应该调用此函数设值
Parameters:
Name Type Description name
string 属性名
value
any 属性值
Returns:
void- Inherited From:
-
setRadios(radios) → {void}
-
设置单选控制器
Parameters:
Name Type Description radios
ht.ui.Radios 单选控制器
Returns:
void- Inherited From:
-
setRedrawOnFocus(redrawOnFocus) → {void}
-
设置组件获取或失去焦点时,是否重绘自身
Parameters:
Name Type Description redrawOnFocus
boolean 是否重绘自身
Returns:
void- Inherited From:
-
setSelectActiveBackground(background) → {void}
-
设置 active 选中状态下的背景
Parameters:
Name Type Description background
any 背景;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectActiveBackgroundDrawable(drawable) → {void}
-
设置 active 选中状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setSelectActiveBorder(border) → {void}
-
设置 active 选中状态下边框
Parameters:
Name Type Description border
ht.ui.border.Border Returns:
void- Inherited From:
-
setSelectActiveIcon(icon) → {void}
-
设置 active 选中状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectActiveIconDrawable(drawable) → {void}
-
设置 active 选中状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setSelectActiveIconTint(color) → {void}
-
Parameters:
Name Type Description color
string Returns:
void- Inherited From:
-
setSelectActiveTextColor(color) → {void}
-
设置 active 选中状态下文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setSelectBackground(background) → {void}
-
设置正常选中状态下的背景
Parameters:
Name Type Description background
any 背景;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectBackgroundDrawable(drawable) → {void}
-
设置正常选中状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setSelectBorder(border) → {void}
-
设置正常选中状态下边框
Parameters:
Name Type Description border
ht.ui.border.Border Returns:
void- Inherited From:
-
setSelectDisabledBackground(background) → {void}
-
设置 disabled 选中状态下的背景
Parameters:
Name Type Description background
any 背景;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectDisabledBackgroundDrawable(drawable) → {void}
-
设置 disabled 选中状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setSelectDisabledBorder(border) → {void}
-
设置 disabled 选中状态下边框
Parameters:
Name Type Description border
ht.ui.border.Border Returns:
void- Inherited From:
-
setSelectDisabledIcon(icon) → {void}
-
设置 disabled 选中状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectDisabledIconDrawable(drawable) → {void}
-
设置 disabled 选中状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setSelectDisabledTextColor(color) → {void}
-
设置 disabled 选中状态下文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setSelected(selected) → {void}
-
设置组件选中状态
Parameters:
Name Type Description selected
boolean 是否选中
Returns:
void- Inherited From:
-
setSelectHoverBackground(background) → {void}
-
设置 hover 选中状态下的背景
Parameters:
Name Type Description background
any 背景;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectHoverBackgroundDrawable(drawable) → {void}
-
设置 hover 选中状态下背景的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 背景
Returns:
void- Inherited From:
-
setSelectHoverBorder(border) → {void}
-
设置 hover 选中状态下边框
Parameters:
Name Type Description border
ht.ui.border.Border Returns:
void- Inherited From:
-
setSelectHoverIcon(icon) → {void}
-
设置 hover 选中状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectHoverIconDrawable(drawable) → {void}
-
设置 hover 选中状态下的图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setSelectHoverIconTint(color) → {void}
-
Parameters:
Name Type Description color
string Returns:
void- Inherited From:
-
setSelectHoverTextColor(color) → {void}
-
设置 hover 选中状态下文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setSelectIcon(icon) → {void}
-
设置正常选中状态下的图标
Parameters:
Name Type Description icon
any 图标;可以是颜色或者图片等
Returns:
void- Inherited From:
-
setSelectIconDrawable(drawable) → {void}
-
设置正常选中状态下图标的 Drawable 对象
Parameters:
Name Type Description drawable
ht.ui.drawable.Drawable 图标
Returns:
void- Inherited From:
-
setSelectIconTint(color) → {void}
-
Parameters:
Name Type Description color
string Returns:
void- Inherited From:
-
setSelectTextColor(color) → {void}
-
设置正常选中状态下文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setState(state) → {void}
-
设置按钮状态
Parameters:
Name Type Description state
string 按钮状态,可选值为:'normal'|'hover'|'active'
Returns:
void- Inherited From:
-
setStyle(property, value) → {void}
-
Parameters:
Name Type Description property
string value
any Returns:
void- Inherited From:
-
setText(text) → {void}
-
设置文字内容
Parameters:
Name Type Attributes Description text
string <optional>
文字内容
Returns:
void- Inherited From:
-
setTextColor(color) → {void}
-
设置文字颜色
Parameters:
Name Type Description color
string 文字颜色
Returns:
void- Inherited From:
-
setTextFont(font) → {void}
-
设置文字字体
Parameters:
Name Type Attributes Description font
string <optional>
文字字体
Returns:
void- Inherited From:
-
setToolTip(toolTip) → {void}
-
设置工具提示文本内容
Parameters:
Name Type Description toolTip
string 工具提示文本内容
Returns:
void- Inherited From:
-
setToolTipEnabled(enabled) → {void}
-
设置是否启用工具提示
Parameters:
Name Type Description enabled
boolean 是否启用工具提示
Returns:
void- Inherited From:
-
setToolTipPlacements(placements) → {any}
-
Parameters:
Name Type Description placements
Array.<string> Returns:
any- Inherited From:
-
setTranslateX(tx) → {void}
-
设置横向滚动偏移
Parameters:
Name Type Description tx
number Returns:
void- Inherited From:
-
setTranslateY(translateY) → {void}
-
Parameters:
Name Type Description translateY
number Returns:
void- Inherited From:
-
setVAlign(vAlign) → {void}
-
设置文字和图标在按钮垂直方向的整体对齐方式,默认为 'middle'
Parameters:
Name Type Description vAlign
string 对齐方式,可选值为 'top'|'bottom'|'middle'
Returns:
void- Inherited From:
-
setValue(value) → {void}
-
设置组件值
Parameters:
Name Type Description value
any 组件值;此值可以放置业务属性
Returns:
void- Inherited From:
-
setVisible(visible) → {void}
-
设置组件是否可见
Parameters:
Name Type Description visible
boolean 组件是否可见
Returns:
void- Inherited From:
-
setVTextPosition(position) → {void}
-
设置文字在垂直方向相对于图标的位置,默认值为 'middle'
Parameters:
Name Type Description position
string 位置,可选值为 'top'|'bottom'|'middle'
Returns:
void- Inherited From:
-
setWidth(width) → {void}
-
设置组件的宽度
Parameters:
Name Type Description width
number 组件宽度
Returns:
void- Inherited From:
-
setX(x) → {void}
-
设置组件的 x 坐标
Parameters:
Name Type Description x
number x 坐标
Returns:
void- Inherited From:
-
setY(y) → {void}
-
设置组件的 y 坐标
Parameters:
Name Type Description y
number y 坐标
Returns:
void- Inherited From:
-
setZIndex(zIndex) → {void}
-
设置组件的堆叠顺序
Parameters:
Name Type Description zIndex
number 堆叠顺序
Returns:
void- Inherited From:
-
setZoom(zoom) → {void}
-
设置缩放
Parameters:
Name Type Description zoom
number 缩放值
Returns:
void- Inherited From:
-
setZoomAnchor(anchor) → {void}
-
设置缩放锚点
Parameters:
Name Type Description anchor
Array.<number> 横向和纵向锚点数组,如右上角为:[1, 0]
Returns:
void- Inherited From:
-
showPopover() → {void}
-
显示弹框组件
Returns:
void- Inherited From:
-
showToolTip(moveEvent) → {void}
-
显示 toolTip
Parameters:
Name Type Description moveEvent
MouseEvent | TouchEvent 鼠标事件对象
Returns:
void- Inherited From:
-
tearDownBorder(border, x, y, width, height, dom) → {void}
-
卸载边框;只有 CSS 类型的边框才需要此函数
Parameters:
Name Type Attributes Description border
ht.ui.border.Border <optional>
边框对象
x
number <optional>
起点 x 坐标
y
number <optional>
起点 y 坐标
width
number <optional>
宽度
height
number <optional>
高度
dom
HTMLElement <optional>
指定绘制的目标 DOM
Returns:
void- Inherited From:
-
ump(listener, scope) → {void}
-
删除属性事件变化监听器,removePropertyChangeListener 的缩写
Parameters:
Name Type Attributes Description listener
Object 监听器函数
scope
any <optional>
函数域
Returns:
void- Inherited From:
-
validate() → {void}
-
重绘组件;此函数负责重新布局组件 DOM、设置层叠关系、加载需要的图片资源、派发 validate 事件等
如果自定义组件,不要重写此函数,而是重写 validateImpl 函数Returns:
void- Inherited From:
-
validateImpl(x, y, width, height) → {void}
-
绘制组件内容;如果自定义组件,一般要重写此函数,通过 getRootContext() 获取画笔然后绘制
Parameters:
Name Type Attributes Description x
number <optional>
内容范围的 x 坐标
y
number <optional>
内容范围的 y 坐标
width
number <optional>
内容范围宽度
height
number <optional>
内容范围高度
Returns:
void- Inherited From: