方法
MethodsTypes
等于 (MethodGroup | MethodTypes | ({ type: BlockType.EVENT } & EventTypes) | [BlockType.EVENT, ...EventTypes] | BlockBoxOptions)[]
MethodGroup
类型:object
描述:方法组。
MethodGroup.label?
类型:string
描述:方法组标签,设置后生成的一组积木上方会显示该标签。
MethodGroup.blockOptions?
类型:BlockOptions
描述:方法组积木选项。组内方法的积木选项会继承该选项。
MethodGroup.contents
类型:MethodsTypes
描述:方法组内容。
MethodTypes
类型:object | Array
Array
是 2.3 版本新增的。
描述:方法。
MethodTypes.key | MethodTypes[0]
类型:string
描述:方法的键名,与控件实体中的方法名对应。
MethodTypes.label | MethodTypes[1]
类型:string
描述:方法的标签。
MethodTypes.block | MethodTypes[2]
类型:(string | MethodBlockParam | MethodParamTypes)[]
描述:方法的积木。
可以是以下内容:
MethodBlockParam.THIS
:this
参数,即控件实例本身,this
参数必须是第一个参数。MethodBlockParam.METHOD
:方法标签文本。- 字符串:说明文本。
- MethodParamTypes:方法参数。
(MethodTypes.returns | MethodTypes[3])?
类型:Type
描述:方法的返回值类型。
不设置或设置为空时,表示没有返回值。
(MethodTypes | MethodTypes[4]).throws?
类型:Type
描述:方法的抛出异常类型。
不设置或设置为空时,表示不会抛出异常。
(MethodTypes | MethodTypes[4]).tooltip?
类型:string
描述:方法提示信息,当鼠标悬停在积木上时显示。