• JS组件 daterangepicker


    1.引用

    <div>
    <div class="input-group" style=" 300px;">
    <span class="input-group-addon">日期范围</span>
    <input id="rangePicker" type="text" class="form-control">
    </div>
    </div>


    <script src="{% static 'plugin/daterangepicker/moment.min.js' %}"></script> <script src="{% static 'plugin/daterangepicker/daterangepicker.js' %}"></script>

    2.初始化

    function initDateRangePicker(){
        //设置为中文 var options
    = { maxDate: moment(), alwaysShowCalendars: true, showWeekNumbers: true, ranges: { '今天': [moment(), moment()], '昨天': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], '最近7天': [moment().subtract(6, 'days'), moment()], '最近30天': [moment().subtract(29, 'days'), moment()], '本月': [moment().startOf('month'), moment().endOf('month')] }, locale: { format: 'YYYY-MM-DD', separator: '', applyLabel: '确定', cancelLabel: '取消', fromLabel: '开始', toLabel: '结束', customRangeLabel: '自定义', weekLabel: 'W', daysOfWeek: ['', '', '', '', '', '', ''], monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], firstDay: 1 } };
            //选择input标签 并初始化 $(
    '#rangePicker').daterangepicker(options, function (start, end, label) { // 选择了时间之后,函数自动被触发。 priority(start.format('YYYY-MM-DD'), end.add(1, 'days').format('YYYY-MM-DD')); projectUser(start.format('YYYY-MM-DD'), end.add(1, 'days').format('YYYY-MM-DD')); }); }
  • 相关阅读:
    RESTful API入门
    $.ajax()参数详解及标准写法(转)
    Jquery 页面首次加载方式
    jQuery操作单选按钮(radio)用法
    GridView的 OnRowDataBound 事件用法
    ASP.NET文件上传大小的限制解决方案
    jQuery经典学习笔记
    Thermal management in a gaming machine
    iis7配置网站容易出现的问题(转)
    你能熟练使用Dictionary字典和List列表吗?(转)
  • 原文地址:https://www.cnblogs.com/hude/p/12848971.html
Copyright © 2020-2023  润新知