下拉列表控件介绍
属性-entries
事件-selected
函数-setSelection
参数:
function main() {
setupUI();
}
function onUIResume() {
var select = ui('select');
select.setSelection(1);
}
函数-getSelectedItemPosition
参数:
function main() {
setupUI();
}
function onUIResume() {
var select = ui('select');
var position = select.getSelectedItemPosition();
console.log('position:' + position);
}
函数-setData
参数:
function main() {
setupUI();
}
function onUIResume() {
var select = ui('select');
select.setData('香蕉|苹果|橘子');
}
函数-value
参数:
function main() {
setupUI();
}
function onUIResume() {
// 获取选中文本
var text = ui('select').value();
console.log('获取text:' + text);
// 设置选中项
ui('select').value(1);
}