说明文档.md 1.63 KB
Newer Older
chase's avatar
chase committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
/** 2018/7/28 by Andy
 **
 **/
 
## 参数列表:
> this-option-map: 
* 下拉的选项映射,
* 接受两种类型的映射:
* 1、基础类型的一维数组 []
* 2、键值对对象 {}

> this-selected: 
* 最终的选项的结果,
* 以String[]类型输出给绑定的值
* 如果data-option-map绑定的是{},则输出选中的元素的key
* 如果绑定的是[],就输出选中的元素

> this-callback: 
* 如果第一时间无法获取承接选项结果的对象
* 可以传入一个回调函数,在函数里面执行赋值操作
* 回调函数的参数为@data-selected和一些公共方法,比如:reset

> this-option-type: 
* 有两种渲染类型:单选-radio 复选-checkbox
* 如果是radio,@this-selected将会返回String
* 如果是checkbox,@this-selected将会返回Array


## 样例:
js:
```javascript
    $scope.optionListType1=['选项一','选项二','选项三'];
    $scope.optionListType2={option1:'选项一',option2:'选项二',option3:'选项三'};
    $scope.selectedSingle="";
    $scope.selectedMulti=[];
    $scope.callback=function(selected,external){}; 
```
html:
```html
<!--单选类型-->
<pms-multi-select style="width:22px;height:22px"
                this-option-type="radio"
                this-option-map="optionListType1"
                this-selected="selectedSingle"
                this-callback="callback">
</pms-multi-select>

<!--复选类型-->
<pms-multi-select style="width:22px;height:22px"
                this-option-type="checkbox"
                this-option-map="optionListType1"
                this-selected="selectedMulti"
                this-callback="callback">
</pms-multi-select>
```