vue2.x ---vue-mobile-calendar的学习使用笔记

项目需求:日历显示2中状态 ,一种是从注册日期起到现在没捐款的日子,一种是捐款过的日子,

 插件github地址:https://github.com/lx544690189/vue-mobile-calendar

插件npm地址:https://www.npmjs.com/package/vue-mobile-calendar 

 1、安装

npm i vue-mobile-calendar
2、引入

import Calendar from 'vue-mobile-calendar'

Vue.use(Calendar);

3、使用(页面内联显示):

<div id="calendar">
        <inlineCalendar v-if='defaultDate.length>0'   mode="multiple"  :disabledDate="disabledDate"  :defaultDate="defaultDate" />
      </div>

该插件分2种形式:

calendar为底部弹窗显示,inlineCalendar为页面内联显示(可放置页面任意地方)

 js:

 data(){
    return {
         defaultDate:[],
         disabledDate:[],
    }
  },

然后在方法中请求参数进行赋值即可,若请求响应太慢,可以使用localStorage进行缓存。

我的需求是只展示,不允许点击,而插件自带点击事件,我取巧写个透明div把日期可点击区域进行了遮挡来阻止点击日期

css:

.home /deep/ .m-calendar .m-months-container .m-months-wrapper .m-months .m-row:last-child{
  display: none;
}
 .home /deep/ .m-calendar .m-months-container .m-months-wrapper .m-months .m-row .m-day .m-today{
   background: none !important;
}
 .home /deep/ .m-calendar .m-months-container .m-months-wrapper .m-months .m-row .m-day .m-select{
  background: url('../assets/jk_noheart.png') no-repeat !important;
  background-size: contain!important;
  color: #666;
}
.home /deep/ .m-calendar .m-months-container .m-months-wrapper .m-months .m-row .m-day .m-disable{
  background: url('../assets/jk_heart.png') no-repeat !important;
  background-size: contain!important;
  text-decoration: none!important;
  color: #fff;
}
.home /deep/ .m-calendar .m-months-container .m-months-wrapper .m-months .m-row .m-day .m-day-num{
  border-radius: 0!important;
}

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值