zoukankan      html  css  js  c++  java
  • layui ri laydate的常规使用,并且日期最大不能超过当前日期

    laydate的常规使用,分为两种方式实现日期组件

    一、在 layui 模块中使用 下载layui   地址 :https://www.layui.com/  引入资源路径 js 和 css


    通过下面这样加载

    <input  id="birthDate" name="birthDate" class="form-control" >
    <script>
        layui.use('laydate', function(){
            var laydate = layui.laydate;
     
            //执行一个laydate实例
            laydate.render({
                elem: '#birthDate', //指定元素
                max: getNowFormatDate()
            });
        });
     
        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                + " " + date.getHours() + seperator2 + date.getMinutes()
                + seperator2 + date.getSeconds();
            return currentdate;
        }
    </script>
  • 相关阅读:
    uniapp跨域
    uniapp图片文件转base64
    懒加载
    修改富文本样式
    搜集到的常用Scheme
    JS浏览器复制
    程序员必须知道的六大ES6新特性
    详解ES6中的 let 和const
    数据库基础
    配置环境变量
  • 原文地址:https://www.cnblogs.com/mica/p/11739153.html
Copyright © 2011-2022 走看看