Picker选择器
- 尽量使用 Picker 来帮助用户完成输入,避免用户通过键盘直接输入。
基本用法
API
PickerService.showPicker(config, confirm?, cancel?)
以上函数调用后,会返回一个引用,可以通过该引用关闭弹窗。
constructor(picker: PickerService) {
const ref: PickerRef = picker.showPicker(
{ value: this.value, data: this.singleArea },
result => {
this.value = this.getValue(result);
cancel => {
console.log('cancel');
}
);
ref.close(); // 或 ref.destroy(); 将直接销毁对话框
PickerRef
通过服务方式 PickerService.xxx()
创建的对话框,都会返回一个 PickerRef
对象,该对象具有以下方法: