Mui自定义时间格式:

Mui自定义时间格式:

(function($) {

         $.init();

         $(document).on('tap','.btn',function(){

                   var obj = getFormJson($('#formid'));

                   // console.log(obj.add_time);

                   // console.log(this.getAttribute('value'));

                   var optionsJson = this.getAttribute('data-options') || '{}';

                   var options = JSON.parse(optionsJson);

                   var id = this.getAttribute('id');

                   console.log(id);

                   // var name = this.getAttribute('name');

                   var picker = new $.DtPicker(options);

                   var _this = this;

                   console.log(this);

                   var dtpicker = new mui.DtPicker({

                       type: "time",//设置日历初始视图模式

                       // beginDate: new Date(2015, 04, 25),//设置开始日期

                       // endDate: new Date(2016, 04, 25),//设置结束日期

                       labels: ['年', '月', '日','时', '分'],//设置默认标签区域提示语

                       customData: {

                           h: [

                               { value: '00', text: '00' },

                               { value: '01', text: '01' },

                               { value: '02', text: '02' },

                               { value: '03', text: '03' },

                               { value: '04', text: '04' },

                               { value: '05', text: '05' },

                               { value: '06', text: '06' },

                               { value: '07', text: '07' },

                               { value: '08', text: '08' },

                               { value: '09', text: '09' },

                               { value: '10', text: '10' },

                               { value: '11', text: '11' },

                               { value: '12', text: '12' },

                               { value: '13', text: '13' },

                               { value: '14', text: '14' },

                               { value: '15', text: '15' },

                               { value: '16', text: '16' },

                               { value: '17', text: '17' },

                               { value: '18', text: '18' },

                               { value: '19', text: '19' },

                               { value: '20', text: '20' },

                               { value: '21', text: '21' },

                               { value: '22', text: '22' },

                               { value: '23', text: '23' }

                           ] ,

                           i:[

                           { value: '00', text: '00' },

                               { value: '05', text: '05' },

                               { value: '10', text: '10' },

                               { value: '15', text: '15' },

                               { value: '20', text: '20' },

                               { value: '25', text: '25' },

                               { value: '30', text: '30' },

                               { value: '35', text: '35' },

                               { value: '40', text: '40' },

                               { value: '45', text: '45' },

                               { value: '50', text: '50' },

                               { value: '55', text: '55' }

                           ]

                       }//时间/日期别名

                   });

                   if(id=="result"){

                            picker.show(function(rs) {

                                     console.log(rs.value);

                                     _this.value = '' + rs.value;

                            });

                   }else{

                            // var iTems = dtpicker.getSelectedItems()

                            dtpicker.show(function(items) {

                                 console.log(items.value);

                                 _this.value = '' + items.value;

                            })

                   }

         },false);

})(mui);

原文地址:https://www.cnblogs.com/xzzzys/p/7826191.html