vue-calendar icon indicating copy to clipboard operation
vue-calendar copied to clipboard

请问大神,是否可以在当前月份跨月选择?Choose Date over month

Open dowinweb opened this issue 7 years ago • 7 comments

目前日期控件使用完美,但产品方面提出,在当前月可以选择临近月份的时间,而不是只能选择当前月,不知是否有属性可以做到?

if i was in September, i cannot pick the date of August, only if i change the month to August.So my question is can i pick date over the month, not disable the other month's date

dowinweb avatar Sep 14 '17 07:09 dowinweb

在不切换月份的情况下,跨月选择,是有点吹毛求疵了 — —

dowinweb avatar Sep 14 '17 08:09 dowinweb

这个目前没法实现,有空我实现一下。

jinzhe avatar Sep 15 '17 09:09 jinzhe

好的。多谢大神

dowinweb avatar Sep 18 '17 01:09 dowinweb

可不可以加上月份选择的下拉框呢?

LindafairyWang avatar Sep 28 '17 09:09 LindafairyWang

可以像酒店预订移动端那样,一下子显示好几个月份,不要箭头按钮来切换月份,直接下滑显示,这个可以参考一下。

damaohub avatar Jan 03 '18 03:01 damaohub

calendar.vue 页面 第 453行,573行,593行 将{day: d,disabled: true} 改为 {day: d,disabled: false} 解除跨月选择禁用 然后再第699行select 法中 添加如下代码即可:

    select(k1, k2, e) {
        if (e != undefined) e.stopPropagation()
        let l =this.days[k1][k2].day //第一次选中
		let s = l; //保存第一次选中
        if ( l>=22 && l<=31 &&  k1 === 0){ //第一行
        	this.month=this.month-1
        }
        
        if ( l<=7 &&  k1 >= 4 ){ //第二行
        	this.month=this.month+1
        }
        
        if ( l>=22 &&  k1 >= 4 && s<=7){
        	this.month=this.month+1
        }
        
        if ( l<=7 &&  k1 === 0 && s>=28){
        	this.month=this.month-1
        }
        
        //跨年选取头部
        if(this.month===-1 && k1===0 && l>=22){
        	this.year = this.year-1
        	this.month = 11
        }
        //跨年选取尾部
         if(this.month===12 && k1>=4 && l<=7){
        	this.year = this.year+1
        	this.month = 0
        }

xcqweb avatar Jun 26 '18 06:06 xcqweb

同问

huoguozhang avatar Jul 02 '18 06:07 huoguozhang