ui Button
# ui.Button
返回一个按钮。
函数 | 返回值 |
---|---|
ui.Button(label, type, style, disabled, onClick)) | Object |
参数 | 类型 | 说明 |
---|---|---|
label | String | 按钮显示的文本 |
type | String | 按钮样式 |
style | Object | 组件样式 |
disabled | Boolean | 按钮是否可用 |
onClick | Function | 点击回调方法 |
# setLabel
设置按钮上显示的文本。
函数 | 返回值 |
---|---|
setLabel(label) | ui.Button |
参数 | 类型 | 说明 |
---|---|---|
label | String|Number|Date | 按钮显示的文本 |
# getLabel
返回按钮上显示的文本。
函数 | 返回值 |
---|---|
getLabel() | String |
# setType
设置按钮样式。
函数 | 返回值 |
---|---|
setType(type) | ui.Button |
参数 | 类型 | 说明 |
---|---|---|
type | String | 按钮样式。 |
# getType
函数 | 返回值 |
---|---|
getType() | String |
# setDisabled
设置按钮是否可用。
函数 | 返回值 |
---|---|
setDisabled(disabled) | ui.Button |
参数 | 类型 | 说明 |
---|---|---|
disabled | Boolean | 按钮是否可用 |
# getDisabled
函数 | 返回值 |
---|---|
getDisabled() | Boolean |
# setStyle
设置Button样式。
函数 | 返回值 |
---|---|
setStyle(style) | ui.Button |
参数 | 类型 | 说明 |
---|---|---|
style | Object | Button样式。 |
# getStyle
返回Button样式。
函数 | 返回值 |
---|---|
getStyle() | Object |
# onClick
点击按钮回调方法。
函数 | 返回值 |
---|---|
onClick(callback) | Object |
参数 | 类型 | 说明 |
---|---|---|
callback | Function | 点击按钮回调方法 |
/**
* @File : ui.Button
* @Time : 2021/3/23
* @Author : piesat
* @Version : 1.0
* @Contact : 400-890-0662
* @License : (C)Copyright 航天宏图信息技术股份有限公司
* @Desc : 按钮组件示例
*/
function clickBtn1() {
print("点击按钮1");
}
function clickBtn2() {
print("点击按钮2");
}
var btn1 = ui.Button({
label: "取消",
onClick: clickBtn1,
});
var btn2 = ui.Button({
label: "确定",
type: "success",
onClick: clickBtn2,
});
print(btn1);
print(btn2);
有问题,我来改改 (opens new window)
上次更新: 2022/05/25, 03:27:07