1.0.0 • Published 4 years ago
@sbc-fe/city-picker-element v1.0.0
基于Vue版 element-ui 二次封装 select 选择器
功能点:
- 1:多选,可搜索,一次性搜索多个数据,以空格分开,可一次性选择多个;
- 2:修复element-ui blur事件无效的bug
3:支持分组和不分组两种模式
使用说明
支持element-ui select 组件的api 1.分组
<city-picker style="width: 500px" inline :multiple="false" :filterable="false" v-model="fix_data.form.area" :value-filter="formatValue" :keys="{label: 'areaName', value: 'areaCode', groupLabel: 'province', children: 'areas'}" :list="cityList" :disabled="fix_data.form.type == 1"></city-picker>
2.不分组
<city-picker style="width: 500px" inline v-model="fix_data.form.area" :value-filter="formatValue" :keys="{label: 'areaName', value: 'areaCode', groupLabel: 'province'}" :list="cityList" :disabled="fix_data.form.type == 1"></city-picker>
:value-filter="formatValue"
formatValue(item) {
return item.areaId + ',' + item.areaCode + ',' + item.areaName
},
Attributes
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
v-model | 绑定值 | string/array | - | - |
list | 数据 | Array/Arrayobject | - | - |
inline | 是否行内 | boolean | true/false | false |
value-filter | value返回值 | Function | - | item.value |
keys | 配置选项,具体看下表 | object | - | - |
disabled | select框禁用 | boolean | true/false | false |
multiple | 是否多选 | boolean | true/false | true |
filterable | 是否可搜索 | boolean | true/false | true |
keys
参数 | 说明 | 类型 | 可选值 | 默认值 |
---|---|---|---|---|
label | 节点显示 | string | - | areaName |
value | 节点绑定值 | string/number | - | areaId |
search | 搜索可匹配值 | string/number | - | areaCode |
children | 子集,keys里是否配置该选项,来判断是否分组 | Arrayobject | - | - |
disabled | 选项禁用 | boolean | true/false | false |
1.0.0
4 years ago