mobiscroll初始化数据添加年月日

	$("#receiveSjzsj-time").mobiscroll().time({
    
    
         theme: 'ios',
         lang: 'zh',
         mode: 'scroller',
         preset: 'date', //日期,可选:date\datetime\time\tree_list\image_text\select
         theme: 'android-ics light', //皮肤样式,可选:default\android\android-ics light\android-ics\ios\jqm\sense-ui\wp light\wp
         display: 'modal', //显示方式 ,可选:modal\inline\bubble\top\bottom
         lang: "Chinese",
         showLabel: true,//false  显示头部
         rows: 5,//显示多少行,定义3就显示3行,
         dateFormat: 'yyyy-mm-dd', // 面板日期格式
         setText: '确认', //确认按钮名称
         cancelText: '取消', //取消按钮名称
         dateOrder: 'yyyymmdd', //面板中日期排列格式
         dayText: '日',
         monthText: '月',
         yearText: '年', //面板中年月日文字
         // showNow: false,
         nowText: "今",
         endYear: currYear + 10, //结束年份
         minDate: new Date(currYear, currMonth - 1, currDay + 1),
         onSelect: function (textVale, inst) {
    
     //选中时触发事件
           console.log("我被选中了.....");
         },
         onClose: function (textVale, inst) {
    
     //插件效果退出时执行 inst:表示点击的状态反馈:set/cancel
           console.log("textVale--" + textVale);
           console.log(this.id);//this表示调用该插件的对象
         }
         onInit: function (inst) {
    
    
             //初始化数据为日期格式添加年月日时分
                inst.settings.wheels[0] = _.map(inst.settings.wheels[0], function (wheelItem, key) {
    
    
                    var labelText = wheelItem.label;
                    wheelItem.values = _.map(wheelItem.values, function (e) {
    
    
                        e = e + labelText;
                        return e;
                    });
                    return wheelItem;
                });
          },
          onSelect: function (valueText, inst) {
    
    
                //点击确定以后的结果
                $scope.receiveSjzsjTime = valueText;
                $scope.receiveSjzsjTime = $filter('date')($scope.receiveSjzsjTime, 'HH:mm');
                $scope.$apply();
            }
        });

在这里插入图片描述
在这里插入图片描述

这里是引用
mobiscroll 下载地址:http://www.jq22.com/jquery-info10900

猜你喜欢

转载自blog.csdn.net/qq_31182399/article/details/107636093