vue-m-calendar

0.0.8 • Public • Published

vue-m-calendar

Calendar component for Vue.js(2.0+)

Install

npm install vue-m-calendar --save

Usage

<template>
  <div>
    <div class="date">日期 <input type="text" placeholder="请输入日期" :value="value" @click="showCalendar"></div>
    <calendar title="选择日期" format="yyyy-MM-dd" :show="calendarShow" :options="calendarOpts" @selected="selectedHandler" @cancel="cancelHandler"></calendar>
  </div>
</template>
import Calendar from 'vue-m-calendar';
export default {
data() {
  return {
    value: '',
    calendarShow: false,
    calendarOpts: {
      disabledDate(time) {
        return time.getTime() < Date.now() - 8.64e7;
      }
    }
  }
},
components: {
  Calendar
},
methods: {
  showCalendar() {
    this.calendarShow = true;
  },
  selectedHandler(date) {
    this.value = date;
    this.calendarShow = false;
  },
  cancelHandler() {
    this.calendarShow = false;
  }
}
}

Demo

http://junyiz.github.io/vue-m-calendar

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i vue-m-calendar

Weekly Downloads

2

Version

0.0.8

License

MIT

Last publish

Collaborators

  • junyiz