1.普通数组格式-非联动
<div id="trigger1"></div> <!--页面中别漏了这个trigger--> <script> var mobileSelect1 = new MobileSelect({ trigger: '#trigger1', title: '日期选择', wheels: [ {data:_data} ], transitionEnd:function(indexArr, data){ console.log(data); }, callback:function(indexArr, data){ console.log(data); $("#trigger1").val(data[0].value+'-'+data[1].value+'-'+data[2].value) } }); </script>
2.json格式-非联动
<div id="trigger2"></div> <script> var mobileSelect1 = new MobileSelect({ trigger: '#trigger2', title: '地区选择', wheels: [ {data:[ {id:'1',value:'附近'}, {id:'2',value:'上城区'}, {id:'3',value:'下城区'}, {id:'4',value:'江干区'}, {id:'5',value:'拱墅区'}, {id:'6',value:'西湖区'} ]} ], transitionEnd:function(indexArr, data){ console.log(data); }, callback:function(indexArr, data){ console.log(data); $("#trigger2").val(data[0].value) } }); </script>
3.json格式-联动
<div id="trigger3"></div>