vue使用vue-calendar-component日历组件(可直接使用)

  1. 下载

    npm i vue-calendar-component
    
  2. vue文件引入

    import Calendar from 'vue-calendar-component';
    components: {
      Calendar
    }
    
  3. 使用

    <div class="con">
      <Calendar
      	   :sundayStart="true"//默认是周一开始 当是true的时候 是周日开始
           :choseDay="handleclickDay"
           :changeMonth="handlechangeMonth"
           :isToday="handleisToday"
           :agoDayHide="String(today)"// 因为是Number格式 要转换成String 不然会报错
       ></Calendar>
    	  // :markDate=arr // arr=['2018/4/1','2018/4/3'] 标记4月1日和4月3日 简单标记
          // :markDateMore=arr // 多种不同的标记
          // 第一个标记和第二个标记不能同时使用
       	  // :agoDayHide='1514937600' //某个日期以前的不允许点击  时间戳10位
          // :futureDayHide='1525104000' //某个日期以后的不允许点击  时间戳10位
          // :sundayStart="true" //默认是周一开始 当是true的时候 是周日开始
    </div>
    data(){
    	return {
    		// 今天之前的日期不可点击
    		today:parseInt(new Date(new Date().getTime() - 24*60*60*1000)/1000),
    		
    	}
    }
    // 今天
    handleclickDay(data){},
    // 左右点击切换月份
    handlechangeMonth(data){},
    // 跳到本月
    handleisToday(data){}
    
  4. css

    /deep/ .con {
        position:absolute;
        top: 40px;
        right: 0;
        z-index:999;
        .wh_top_changge li{
            color:#000;
        }
        .wh_jiantou1{
            border-top: 2px solid #000;
            border-left: 2px solid #000;
        }
        .wh_jiantou2 {
            border-top: 2px solid #000;
            border-right: 2px solid #000;
        }
        .wh_content_all{
            background:#fff !important;
            border: 1px solid rgba(238, 238, 238, 1);
        }
        .wh_content_item{
            color:#000;
        }
        .wh_item_date:hover{
            background: #eee;
            color:#fff;
        }
        .wh_content_item .wh_isToday{
            background: #186CFF ;
            color:#fff;
        }
        .wh_content_item .wh_chose_day{
            background: #eee;
            color:#fff;
        }
    }
    
  5. 相关API
    在这里插入图片描述

  6. 修改后的效果展示

在这里插入图片描述

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值