Warning: file_exists(): File name is longer than the maximum allowed path length on this platform (260): C:\wwwroot\www.ynlykl.com/wp-content/themes/mkBlog/single-post-%e3%80%90iview%e3%80%91%e6%97%a5%e6%9c%9f%e9%80%89%e6%8b%a9%e5%99%a8%e8%ae%be%e7%bd%ae%e9%bb%98%e8%ae%a4%e9%80%89%e6%8b%a9%e6%97%b6%e9%97%b4%e5%8f%8a%e9%99%90%e5%88%b6%e9%80%89%e6%8b%a9%e6%97%b6.php in C:\wwwroot\www.ynlykl.com\wp-includes\template.php on line 703

Warning: file_exists(): File name is longer than the maximum allowed path length on this platform (260): C:\wwwroot\www.ynlykl.com/wp-content/themes/mkBlog/single-post-%e3%80%90iview%e3%80%91%e6%97%a5%e6%9c%9f%e9%80%89%e6%8b%a9%e5%99%a8%e8%ae%be%e7%bd%ae%e9%bb%98%e8%ae%a4%e9%80%89%e6%8b%a9%e6%97%b6%e9%97%b4%e5%8f%8a%e9%99%90%e5%88%b6%e9%80%89%e6%8b%a9%e6%97%b6.php in C:\wwwroot\www.ynlykl.com\wp-includes\template.php on line 706

Warning: file_exists(): File name is longer than the maximum allowed path length on this platform (260): C:\wwwroot\www.ynlykl.com/wp-includes/theme-compat/single-post-%e3%80%90iview%e3%80%91%e6%97%a5%e6%9c%9f%e9%80%89%e6%8b%a9%e5%99%a8%e8%ae%be%e7%bd%ae%e9%bb%98%e8%ae%a4%e9%80%89%e6%8b%a9%e6%97%b6%e9%97%b4%e5%8f%8a%e9%99%90%e5%88%b6%e9%80%89%e6%8b%a9%e6%97%b6.php in C:\wwwroot\www.ynlykl.com\wp-includes\template.php on line 709
【IVIEW】日期选择器设置默认选择时间及限制选择时间 | 越努力越快乐

【IVIEW】日期选择器设置默认选择时间及限制选择时间

gengboxb 634 0

限制选择时间

html代码

<date-picker v-model='dateSelect' placement="bottom-end" :options="options" type="daterange" placeholder="请选择时间..." style="width: 200px" split-panels></date-picker>

vue中data数据结构,设置7天内可选择

options: {
    disabledDate(date) {
        let curDate = (new Date()).getTime();
        let three = 7 * 24 * 3600 * 1000;
        let threeMonths = curDate - three;
        return date.valueOf() > Date.now() || date.valueOf() < threeMonths;
    },
},

设置当前前面的日期可选择,后面日期不可选择

options: {
        disabledDate(date) {
          return date && date.valueOf() > Date.now();
        },
 },

设置默认选择时间

// 设置时间间隔为7天
setTime() {
    return [new Date(new Date(new Date().getTime() - (6 * 24 * 60 * 60 * 1000))), new Date(new Date())];
},

赋值

this.dateSelect = this.setTime(); // 设置时间间隔为7天

发表评论 取消回复
表情 图片 链接 代码

分享