ui.TextBox
# ui.TextBox
返回一个文本输入框。
函数 | 返回值 |
---|---|
ui.TextBox(placeholder, value, onChange, disable, style) | ui.TextBox |
参数 | 类型 | 说明 |
---|---|---|
placeholder | String | value为空时默认显示内容 |
value | String | 显示内容 |
onChange | Function | 文本改变触发事件 |
disabled | Boolean | 是否禁用 |
style | Object | 文本输入框组件样式 |
# setPlaceholder
设置默认显示内容。
函数 | 返回值 |
---|---|
setPlaceholder(placeholder) | ui.TextBox |
# getPlaceholder
返回默认显示内容。
函数 | 返回值 |
---|---|
getPlaceholder() | Object |
# setValue
设置文本框内容。
函数 | 返回值 |
---|---|
setValue(value) | ui.TextBox |
参数 | 类型 | 说明 |
---|---|---|
value | String | 文本框内容 |
# getValue
返回文本框内容。
函数 | 返回值 |
---|---|
getValue() | Object |
# setDisabled
设置是否禁用。
函数 | 返回值 |
---|---|
setDisabled(disable) | ui.TextBox |
参数 | 类型 | 说明 |
---|---|---|
disable | Boolean | 是否禁用 |
# getDisabled
返回是否禁用。
函数 | 返回值 |
---|---|
getDisabled() | Boolean |
# onChange
文本输入内容回调方法。
函数 | 返回值 |
---|---|
onChange(callback) | String |
参数 | 类型 | 说明 |
---|---|---|
callback | Function | 文本输入内容回调方法 |
# setStyle
设置文本框组件样式。
函数 | 返回值 |
---|---|
setStyle(style) | ui.TextBox |
参数 | 类型 | 说明 |
---|---|---|
style | Object | 文本框样式 |
# getStyle
返回文本框组件样式。
函数 | 返回值 |
---|---|
getStyle() | Object |
/**
* @File : ui.TextBox
* @Time : 2021/3/23
* @Author : piesat
* @Version : 1.0
* @Contact : 400-890-0662
* @License : (C)Copyright 航天宏图信息技术股份有限公司
* @Desc : 输入框组件示例
*/
function funTextBox(value) {
print(value);
}
var textBox = ui.TextBox({
placeholder: "请输入日期",
value: "2020-12-02",
onChange: funTextBox,
disabled: false,
});
var textboxName = ui.Label("输入开始日期:");
var textboxPanel = ui.Panel({
widgets: [textboxName, textBox],
layout: ui.Layout.flow("horizontal"),
});
Map.addUI(textboxPanel);
有问题,我来改改 (opens new window)
上次更新: 2022/05/25, 03:27:07