ui.Select
# ui.Select
返回一个下拉列表。
函数 | 返回值 |
---|---|
ui.Select(items, placeholder, value, multiple, onChange, disabled, style) | ui.Select |
参数 | 类型 | 说明 |
---|---|---|
items | Array | 类表数据,即每个选项对应的具体文本 |
placeholder | String | 默认显示的文本 |
value | String|Array | 当前选择值 |
multiple | Boolean | 是否可以多选 |
onChange | Function | 选择不同值时触发的方法 |
disabled | Boolean | 下拉列表是否可用 |
style | Object | 组件样式 |
# setItems
设置类表数据,即每个选项对应的具体文本。
函数 | 返回值 |
---|---|
setItems(items) | ui.Select |
参数 | 类型 | 说明 |
---|---|---|
items | Array | 类表数据,即每个选项对应的具体文本 |
# getItems
返回类表数据,即每个选项对应的具体文本。
函数 | 返回值 |
---|---|
getItems() | Array |
# setPlaceholder
设置默认显示的文本。
函数 | 返回值 |
---|---|
setPlaceholder(placeholder) | ui.Select |
# getPlaceholder
返回默认显示的文本。
函数 | 返回值 |
---|---|
getPlaceholder() | String |
# setValue
设置当前选择值。
函数 | 返回值 |
---|---|
setValue(value) | ui.Select |
参数 | 类型 | 说明 |
---|---|---|
value | String|Array | 当前选择值 |
# getValue
返回当前选择值。
函数 | 返回值 |
---|---|
getValue() | String|Array |
# setMultiple
设置是否可以多选。
函数 | 返回值 |
---|---|
setMultiple(multiple) | ui.Select |
参数 | 类型 | 说明 |
---|---|---|
multiple | Boolean | 是否可以多选 |
# getMultiple
返回是否可以多选。
函数 | 返回值 |
---|---|
getMultiple() | Boolean |
# setDisabled
设置下拉列表是否可用。
函数 | 返回值 |
---|---|
setDisabled(disable) | ui.Select |
参数 | 类型 | 说明 |
---|---|---|
disable | Boolean | 下拉列表是否可用 |
# getDisabled
返回下拉列表是否可用。
函数 | 返回值 |
---|---|
getDisabled() | Boolean |
# setStyle
设置Select样式。
函数 | 返回值 |
---|---|
setStyle(style) | ui.Select |
参数 | 类型 | 说明 |
---|---|---|
style | Object | Button样式 |
# getStyle
返回Select样式。
函数 | 返回值 |
---|---|
getStyle() | Object |
# onChange
点击下拉列表回调方法。
函数 | 返回值 |
---|---|
onChange(callback) | Object |
参数 | 类型 | 说明 |
---|---|---|
callback | Function | 下拉列表回调方法 |
/**
* @File : ui.Select
* @Time : 2021/3/23
* @Author : piesat
* @Version : 1.0
* @Contact : 400-890-0662
* @License : (C)Copyright 航天宏图信息技术股份有限公司
* @Desc : 下拉列表组件示例
*/
function changeSelect(value) {
print("选择的数据: " + value);
}
var select1 = ui.Select({
items: ["Landsat-8", "Sentinel-2", "GF-1"],
placeholder: "请选择",
value: "Landsat-8",
multiple: false,
onChange: changeSelect,
});
var selectName = ui.Label("选择卫星:");
var selectPanel = ui.Panel({
widgets: [selectName, select1],
layout: ui.Layout.flow("horizontal"),
style: {
width: "230px"
}
});
ui.root.add(selectPanel);
有问题,我来改改 (opens new window)
上次更新: 2022/05/25, 03:27:07