Picker
tingle-picker 是 tingle-xxxpicker 的容器控件。提供一个搜索条和一个可以垂直滚动的列表容器。
效果图:
Simple Usage
{ superprops; thisstate = city: city filter: '' ;} { let t = this; let arr = let groups = Object; groups; return arr;} { let t = this; let target = ecurrentTarget; let name = target; let group = target; let data = citygroup0; ;} { let t = this; t; t} /** * 判断是否是汉字 */ { return /^[\u4e00-\u9fa5]+$/;} { let t = this; let groups = Object; let newCity = {}; if t groups; else groups; t} { let t = this; return <Picker show=true showSearchBar=true filter=tstatefilter onSearch=t_handleSearch> <PickerList> t </PickerList> </Picker> }
Options 可用配置
配置项 | 类型 | 必填 | 默认值 | 功能/备注 |
---|---|---|---|---|
filter | string | optional | - | 开启搜索时的默认搜索值 |
show | boolean | optional | false | 是否显示 |
offsetTop | number | optional | 0 | picker 的主体部分距离顶端的高度,用于在 picker 插入自定义的部分 |
offsetBottom | number | optional | 0 | picker 的主体部分距离底端的高度,用于在 picker 插入自定义的部分 |
searchPlaceholder | string | optional | 中文/拼音/首字母 | |
showSearchBar | boolean | optional | false | 是否显示搜索条 |
onSearch | function | optional | - | 搜索条中的值发生改变时触发,可以在此时通过更改 filter 来改变 searchbar 里的显示 |