仿ios的1-n級聯動指令碼二

來源:互聯網
上載者:User

標籤:callback   one   聯動   分享   img   dex   cal   fun   西湖   

 

一,圖片

 

二,代碼2.1,html指令碼

var weekdayArr=[‘周日‘,‘周一‘,‘周二‘,‘周三‘,‘周四‘,‘周五‘,‘周六‘];
var timeArr = [‘08:30‘,‘09:00‘,‘09:30‘,‘10:00‘,‘10:30‘,‘11:00‘,‘11:30‘,‘12:00‘,‘12:30‘,‘13:00‘,‘13:30‘,‘14:00‘,‘14:30‘,‘15:00‘,‘15:30‘,‘16:00‘,‘16:30‘,‘17:00‘,‘17:30‘,‘18:00‘,‘18:30‘,‘19:00‘,‘19:30‘,‘20:00‘,‘20:30‘,‘21:00‘];
var numArr=[‘1‘,‘2‘,‘3‘,‘4‘,‘5‘];

var UplinkData =
[
{id:‘1‘,value:‘蘭博基尼‘},
{
id:‘2‘,
value:‘勞斯萊斯‘,
childs:[
{
id:‘1‘,
value:‘曜影‘
},
{
id:‘2‘,
value:‘幻影‘,
childs:[
{
id:‘1‘,
value:‘標準版‘
},
{
id:‘2‘,
value:‘加長版‘
},
{
id:‘3‘,
value:‘巔峰之旅‘
},
{
id:‘4‘,
value:‘流光熠世‘
},
{
id:‘5‘,
value:‘都會典藏版‘
}
]
},
{
id:‘3‘,
value:‘古思特‘,
childs:[
{
id:‘1‘,
value:‘加長版‘
},
{
id:‘2‘,
value:‘永恒之愛‘
},
{
id:‘3‘,
value:‘英驥‘
},
{
id:‘4‘,
value:‘阿爾卑斯典藏版‘
}
]
},
{
id:‘4‘,
value:‘魅影‘,
childs:[
{
id:‘1‘,
value:‘標準版‘
},
{
id:‘2‘,
value:‘Black Badge‘
}
]
}
]
},
{
id:‘3‘,
value:‘賓利‘,
childs:[
{
id:‘1‘,
value:‘慕尚‘,
childs:[
{
id:‘1‘,
value:‘標準版‘
},
{
id:‘2‘,
value:‘極致版‘
}
]
},
{
id:‘2‘,
value:‘歐陸‘,
childs:[
{
id:‘1‘,
value:‘尊貴版‘
},
{
id:‘2‘,
value:‘敞篷標準版‘
},
{
id:‘3‘,
value:‘敞篷尊貴版‘
}
]
}
]
},
{
id:‘4‘,
value:‘法拉利‘,
childs:[
{
id:‘1‘,
value:‘LaFerrari‘
},
{
id:‘2‘,
value:‘法拉利488‘
},
{
id:‘3‘,
value:‘GTC4Lusso‘
}
]
},
{
id:‘5‘,
value:‘瑪莎拉蒂‘,
childs:[
{
id:‘1‘,
value:‘總裁‘
},
{
id:‘2‘,
value:‘瑪莎拉蒂GT‘
},
{
id:‘3‘,
value:‘Levante‘
}
]
}
];


//----------------------------------------------------------

//只有trigger 和 wheels 是必要參數 其他都是選填參數
var mobileSelect1 = new MobileSelect({
trigger: ‘#trigger1‘,
title: ‘單項選擇‘,
wheels: [
{data: weekdayArr}
],
position:[2] //初始化定位 開啟時預設選中的哪個 如果不填預設為0
});


var mobileSelect2 = new MobileSelect({
trigger: ‘#trigger2‘,
title: ‘雙項選擇‘,
wheels: [
{data: weekdayArr},
{data: timeArr}
],
position:[1, 2]
});


var mobileSelect3 = new MobileSelect({
trigger: ‘#trigger3‘,
title: ‘多項選擇‘,
wheels: [
{data: numArr},
{data: numArr},
{data: numArr},
{data: numArr},
{data: numArr}
],
position:[0, 1, 0, 1, 0],
transitionEnd:function(indexArr, data){
},
callback:function(indexArr, data){
}
});


var mobileSelect4 = new MobileSelect({
trigger: ‘#trigger4‘,
title: ‘地區選擇‘,
wheels: [
{data:[
{
id:‘1‘,
value:‘附近‘,
childs:[
{id:‘1‘,value:‘1000米‘},
{id:‘2‘,value:‘2000米‘},
{id:‘3‘,value:‘3000米‘},
{id:‘4‘,value:‘5000米‘},
{id:‘5‘,value:‘10000米‘}
]
},
{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);
}
});


var mobileSelect5 = new MobileSelect({
trigger: ‘#trigger5‘,
title: ‘車型選擇‘,
wheels: [
{data : UplinkData}
],
transitionEnd:function(indexArr, data){
console.log(data);
},
callback:function(indexArr, data){
console.log(data);
}
});

 

仿ios的1-n級聯動指令碼二

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.