标签:sel ons min OLE return element range restrict rda
来源:https://www.layui.com/doc/modules/laydate.html#type (function () { angular .module(‘common-dir‘) .directive(‘dirDatepicker‘, function () { return { restrict: ‘E‘, template: ‘<input type="text" class="form-control common-select-time" ng-model="dateModel" id="{{dateInputId}}" style="width:214px" ng-disabled="disable" />‘, replace: true, scope: { right: ‘@‘, dateModel: ‘=dateModel‘, out: ‘@‘, disable: ‘=‘, updata: ‘&‘ }, controller: function ($scope) { $scope.dateInputId = ‘id‘ + new Date().getTime() + parseInt(Math.random() * 10000); angular.element(document).ready(function () { var config = { elem: ‘#‘ + $scope.dateInputId, theme: ‘#007bff‘, trigger: ‘click‘, done: function (value) { $scope.dateModel = value; angular.isFunction($scope.updata) ? $scope.updata() : ‘‘; } }; if ($scope.out) { config.format = $scope.out;//自定义格式 } else { config.type = ‘datetime‘;//控件选择类型 } laydate.render(config); }); }, link: function () { } }; }); })(); 控件选择完毕后的回调 点击日期、清空、现在、确定均会触发。回调返回三个参数,分别代表:生成的值、日期时间对象、结束的日期时间对象 codelayui.code laydate.render({ elem: ‘#test‘, done: function(value, date, endDate){ console.log(value); //得到日期生成的值,如:2017-08-18 console.log(date); //得到日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0} console.log(endDate); //得结束的日期时间对象,开启范围选择(range: true)才会返回。对象成员同上。 } });
168、angular1里用layui中的datetime示例
标签:sel ons min OLE return element range restrict rda
原文地址:https://www.cnblogs.com/gushixianqiancheng/p/12103737.html