vue-event-calendar

vue-event-calendar

vue-event-calendar是一款简单小巧的事件日历组件,针对Vue2开发。样式美观,且响应式。 在线例子

npm version

依赖

  • vue: ^2.0.0

使用方法

安装
 npm install vue-event-calendar --save
入口 Main.js
import vueEventCalendar from 'vue-event-calendar'
Vue.use(vueEventCalendar, {locale: 'en'}) //locale can be 'zh' or 'en'
用法示例
<template>
  <vue-event-calendar :events="demoEvents"></vue-event-calendar>
</template>

<script>
export default {
  data () {
    return {
      demoEvents: [{
        date: '2016/12/15',
        title: 'eat',
        desc: 'longlonglong description'
      },{
        date: '2016/11/12',
        title: 'this is a title'
      }]
    }
  }
}
</script>

自定义

vue-event-calendar允许自定义事件模版,但是这个功能需要Vue 2.1.0版本以上才可以使用。原因是我试用了2.1.0以上才有的新功能作用域插槽(Scoped Slots)。

自定义颜色
//When Vue.use, you can give a color
Vue.use(vueEventCalendar, {locale: 'en', color: '#4fc08d'})
自定义事件模版(可以允许你展示更多信息)
<template>
  <vue-event-calendar :events="demoEvents">
      <template scope="props">
        <div v-for="(event, index) in props.showEvents" class="event-item">
          <!-- 这里拿到的是传入的单个event所有数据 -->
          {{event}}
        </div>
      </template>
    </vue-event-calendar>
</template>

<script>
export default {
  data () {
    return {
      demoEvents: [{
        date: '2016/12/15',
        title: 'eat',
        desc: 'longlonglong description'
      },{
        date: '2016/11/12',
        title: 'this is a title'
      }]
    }
  }
}
</script>

API

// 下个月
this.$EventCalendar.nextMonth()
// 上个月
this.$EventCalendar.preMonth()
//到指定日期
this.$EventCalendar.toDate('2016/11/12')

可以看我写的Demo

开发

可以在github直接clone我的项目然后执行如下命令继续二次开发或发版,欢迎star&&issue

npm run dev  //develop
npm run build //production

转载于:https://my.oschina.net/u/3095416/blog/810715

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值