layui常用插件(二) 时间插件 |
您所在的位置:网站首页 › layui插件 › layui常用插件(二) 时间插件 |
日期和时间
html js layui.use([‘carousel‘,‘laydate‘], function() { var carousel = layui.carousel, laydate = layui.laydate; //常规轮播 carousel.render({ elem: ‘#test1‘ /* ,full:true*/ /* ,width: ‘100%‘ //设置容器宽度 ,height: ‘100%‘ //设置容器高度*/ , arrow: ‘always‘//始终显示箭头 ,anim: ‘default‘ //切换动画方式 ,interval:‘1000‘//自动切换的时间间隔,不能低于800 ,indicator:‘inside‘//指示器位置,如果设定了 anim:‘updown‘,该参数将无效 /* ,arrow:‘hover‘*/ }); laydate.render({ elem: ‘#test2‘ //指定元素 ,type:‘date‘ /*,range: true*/ ,format:‘yyyy-MM-dd‘//默认格式 ,value: new Date()//初始默认时间 2020-02-22 ,min: ‘2017-1-1‘ ,max: 0 ,theme: ‘#393D49‘ ,ready: function(date){ console.log(date); //得到初始的日期时间对象:{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0} } ,change: function(value, date, endDate){ console.log(value); //得到日期生成的值,如:2017-08-18 } ,done: function(value, date, endDate){ console.log(value); //得到日期生成的值,如:2017-08-18 } }); })如果运用layui多个插件,在定义用这种方式
时间与日期常用属性 type:year; //年选择器month; //年月选择器date; //日期选择器(默认)time; //时间选择器、datetime; //日期时间选择器,可选择:年、月、日、时、分、秒range:范围选择如果设置 true,将默认采用 “ - ” 分割。 你也可以直接设置 分割字符 :range: ‘~‘![]()
layui常用插件(二) 时间插件 原文:https://www.cnblogs.com/dk2557/p/12990795.html |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |