mishe / blog

前端碰上的问题或体会
230 stars 39 forks source link

timePicker 使用范例 #112

Open mishe opened 8 years ago

mishe commented 8 years ago

调用范例

var booksInfo=[];
        var picker=$.timePicker({
            selected:curSelected,
            changeDay:function(day){
                var info=booksInfo[day]||['15:00','17:00','21:00'];
                if(info){
                    mockBooksInfo(info);
                }else{
                    getBooksInfo(day);
                }
                function mockBooksInfo(info){
                    $.each(info,function(i,n){
                        $('.pick-time[data-value="'+n+'"]').addClass('booked').append('<span class="booked-txt">预约</span>');
                    });
                }
            }
        },function(){
            curSelected=picker.getDay()+' '+picker.getTime();
            console.log(curSelected)
        });

效果图: