vue-multi-picker
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -5,3 +5,5 @@ 'use strict'; | ||
var CalendarDay = { template: "<table class=vmp-calendar-day><tr><th colspan=7><div class=calendar-title>{{ period.get('y') }} 年 {{ period.get('M') + 1 }} 月</div><tr><th v-for=\"day in weekDays\"><div class=calendar-weekdays>{{ day }}</div><tr v-for=\"week in calendarWeeks\"><td v-for=\"day in calendar.slice(week * 7, week * 7 + 7)\"><div class=calendar-item :class=getClass(day.clone()) @click=click(day.clone()) @mouseenter=enter(day.clone())>{{ day.get('date') }}</div></table>", | ||
var TODAY = moment().startOf('d'); | ||
var CalendarDay = { template: "<table class=vmp-calendar-day><tr><th colspan=7><div class=calendar-title>{{ period.get('y') }} 年 {{ period.get('M') + 1 }} 月</div><tr><th v-for=\"day in weekDays\"><div class=calendar-weekdays>{{ day }}</div><tr v-for=\"week in calendarWeeks\"><td v-for=\"day in calendar.slice(week * 7, week * 7 + 7)\"><div class=calendar-item :class=getClass(day.clone()) @click=click(day.clone()) @mouseenter=enter(day.clone())>{{ current.isSame(day, 'd') ? '今天' : day.get('date') }}</div></table>", | ||
name: 'CalendarDay', | ||
@@ -42,2 +44,3 @@ | ||
this.weekDays = moment.weekdaysShort(true); | ||
this.current = TODAY; | ||
return {}; | ||
@@ -77,2 +80,4 @@ }, | ||
getClass: function getClass(day) { | ||
var isCurrent = day.isSame(TODAY, 'd'); | ||
var isOutter = day.get('M') !== this.period.get('M'); | ||
@@ -89,2 +94,3 @@ var isRestrict = this.restrict(moment.range(day.clone().startOf('d'), day.clone().endOf('d'))); | ||
return { | ||
'current': isCurrent, | ||
'outter': isOutter, | ||
@@ -213,2 +219,4 @@ 'restrict': isRestrict, | ||
var THIS_WEEK = moment().startOf('w'); | ||
var CalendarWeek = { template: "<table class=vmp-calendar-week><tr><th><div class=calendar-title>{{ period.get('y') }} 年 {{ period.get('M') + 1 }} 月</div><tr v-for=\"week in weeks\"><td><div class=calendar-item :class=getClass(week.clone()) @click=click(week.clone())>{{ getWeekInfo(week.clone()) }}</div></table>", | ||
@@ -260,5 +268,7 @@ name: 'CalendarWeek', | ||
getClass: function getClass(week) { | ||
var isCurrent = week.start.isSame(THIS_WEEK, 'w'); | ||
var isSelected = this.selected && this.selected.start.isSame(week.start, 'd') && this.selected.end.isSame(week.end, 'd'); | ||
var isRestrict = this.restrict(week); | ||
return { | ||
'current': isCurrent, | ||
'selected': isSelected, | ||
@@ -290,2 +300,4 @@ 'restrict': isRestrict | ||
var THIS_MONTH = moment().startOf('M'); | ||
var CalendarMonth = { template: "<table class=vmp-calendar-month><tr><th colspan=4><div class=calendar-title>{{ period.get('y') }} 年</div><tr v-for=\"_ in 3\"><td v-for=\"__ in 4\"><div class=calendar-item :class=\"getClass(_ * 4 + __)\" @click=\"click(_ * 4 + __)\">{{ _ * 4 + __ + 1 }} 月</div></table>", | ||
@@ -326,5 +338,7 @@ name: 'CalendarMonth', | ||
var monthMoment = moment({ y: this.period.year(), M: month }); | ||
var isCurrent = monthMoment.isSame(THIS_MONTH, 'M'); | ||
var isSelected = this.selected && this.selected.start.isSame(monthMoment.startOf('M'), 'd') && this.selected.end.isSame(monthMoment.endOf('M'), 'd'); | ||
var isRestrict = this.checkRestrict(month); | ||
return { | ||
'current': isCurrent, | ||
'selected': isSelected, | ||
@@ -331,0 +345,0 @@ 'restrict': isRestrict |
{ | ||
"name": "vue-multi-picker", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "A multi function date picker", | ||
@@ -5,0 +5,0 @@ "keywords": "datepicker weekpicker monthpicker", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
29648
433