Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xfhxbb committed Mar 17, 2016
1 parent e0120da commit 30d5115
Showing 1 changed file with 50 additions and 5 deletions.
55 changes: 50 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LArea v1.4移动端城市选择控件
LArea v1.5移动端城市选择控件
==========
纯原生js的移动端城市选择插件,不依赖任何库
##用法
Expand All @@ -25,14 +25,18 @@ LArea v1.4移动端城市选择控件
...
var area = new LArea();
area.init({
'trigger': '#demo1',//控件ID
'data':LAreaData//数组格式数据源,可扩展为自定义数据源
'trigger': '#demo1',//触发选择控件的文本框,同时选择完毕后name属性输出到该位置
'valueTo':'#value1',//选择完毕后id属性输出到该位置
'keys':{id:'id',name:'name'},//绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出
'type':1,//数据源类型
'data':LAreaData//数据源
});
...
```
自定义数据源结构参考:
```
var LAreaData = [{
//初始化type=1时,参考下列数据源
var LAreaData1 = [{
"id": "2",
"name": "一级",
"child": [{
Expand All @@ -56,5 +60,46 @@ var LAreaData = [{
"name": "二级3"
}]
}];
//初始化type=2时,参考下列数据源
var provs_data = [{
"text": "省",
"value": "1"
}, {
"text": "省",
"value": "2"
}];
var citys_data = {
"1": [{
"text": "市",
"value": "11"
}, {
"text": "市",
"value": "12"
}],
"2": [{
"text": "市",
"value": "21"
}, {
"text": "市",
"value": "22"
}]
};
var dists_data = {
"11": [{
"text": "区",
"value": "111"
}, {
"text": "区",
"value": "112"
}],
"21": [{
"text": "区",
"value": "211"
}, {
"text": "区",
"value": "212"
}]
};
```
调用起来非常简单,代码我后续会持续优化,如果喜欢希望赏颗星哦。
代码会持续优化,如果喜欢希望赏颗星哦。

0 comments on commit 30d5115

Please sign in to comment.