MUI自定义select down 下拉框
//一级联动数据
var data1=[ {value:'01',text:'身份证'}, {value:'02',text:'学生证'}, {value:'03',text:'护照'}, {value:'03',text:'驾照'} ];
//二级联动数据 var data2=[ { value:'01', text:'按样品名称分类', children:[ {value:'0101',text:'苹果'}, {value:'0102',text:'梨子'}, {value:'0103',text:'香蕉'}, {value:'0104',text:'菠萝'}, {value:'0105',text:'桃子'} ] }, { value:'02', text:'按样品所在商城分', children:[ {value:'0201',text:'天猫'}, {value:'0202',text:'淘宝'}, {value:'0203',text:'苏宁'}, {value:'0204',text:'京东'} ] }, { value:'03', text:'按样品大小分', children:[ {value:'0301',text:'小的'}, {value:'0302',text:'中等'}, {value:'0303',text:'大的'} ] }, ]; //三级联动数据 var data3=[ { value: '110000', text: '北京市', children:[ { value: "0101", text: "北京市", children:[ {value: "110101",text: "东城区"}, {value: "110230",text: "其它区"} ] } ] }, { value: '120000', text: '天津市', children:[ { value: "120100", text: "天津市", children:[ {value: "120101",text: "和平区"}, {value: "120226",text: "其它区"} ] } ] }, { value: '130000', text: '河北省', children:[ { value: "130100", text: "石家庄市", children: [ {value: "130102",text: "长安区"}, {value: "130103",text: "桥东区"}, {value: "130104",text: "桥西区"}, {value: "130186",text: "其它区"} ] }, ] } ];
function dataPicker(data,layerNum,pickerObj){ var dataPicker=new mui.PopPicker({ layer:layerNum }); var resultObj=pickerObj.getElementsByTagName("input")[0]; dataPicker.setData(data); dataPicker.show(function(items){ if(layerNum==1){ resultObj.setAttribute("value",items[0].text); tabCheck(); } if(layerNum==2){ resultObj.setAttribute("value",items[0].text+ " " + items[1].text); } if(layerNum==3){ resultObj.setAttribute("value",items[0].text+ " " + items[1].text+" "+ items[2].text); } }); } function timePicker(pickerObj){ var optionJson=pickerObj.getAttribute('data-options') || '{}'; var options=JSON.parse(optionJson); var timePicker = new mui.DtPicker(options); var resultObj=pickerObj.getElementsByTagName("input")[0]; timePicker.show(function(rs){ resultObj.setAttribute("value",rs.text); timePicker.dispose(); }); } function tabCheck(){ if($("#picker1").val()=="不动产权证号"){ $(".check1").show(); $(".check2").hide(); $(".exampleBox").show(); $(".exampleBox").find("a").attr("href","#img-pop1"); }else if($("#picker1").val()=="老权证号"){ $(".check1").hide(); $(".check2").show(); $(".exampleBox").show(); $(".exampleBox").find("a").attr("href","#img-pop2"); }else{ $(".check1").hide(); $(".check2").hide(); $(".exampleBox").hide(); } }
DO What You Want !