11<template >
22 <div >
3- <div class =" datepicker-inner " v-for =" month, i in text.months" >
4- <div class =" datepicker -body" >
3+ <div class =" month-container " v-for =" month, i in text.months" >
4+ <div class =" month -body" >
55 <p >{{month}}</p >
6- <div class =" datepicker-weekRange " >
6+ <div class =" dayOfWeekLabels " >
77 <span v-for =" w in text.daysOfWeek" >{{w}}</span >
88 </div >
9- <div class = " datepicker-dateRange " >
9+ <div >
1010 <span v-for =" d in dateRange[i]" class =" day-cell" :class =" getItemClasses(d)" @click =" daySelect(d, $event)" >
1111 <div >
1212 {{d.text}}
@@ -54,14 +54,23 @@ export default {
5454 methods: {
5555 getItemClasses (d ) {
5656 const dateStr = d .date .toJSON ().substring (0 ,10 );
57- let classes = [];
57+ let classes = [' datepicker-item ' ];
5858 if (! d .isCurrentMonth ) {
59- classes .push (' datepicker-item-gray' );
59+ classes .push (' gray' );
60+ } else if (this .selectedDays [dateStr]) {
61+ classes .push (' active' );
6062 }
61- // debugger;
62- // TODO: set 'datepicker-dateRange-item-active' class on selected days
63- else if (this .selectedDays [dateStr]) {
64- classes .push (' datepicker-dateRange-item-active' );
63+
64+ if (' isWeekend' ) {
65+ classes .push (' datepicker-weekend' );
66+ }
67+ if (' isSelected' ) {
68+ // classes.push('datepicker-dateRange-item-active');
69+ }
70+ if (' isYomTov' ) {
71+ classes .push (' datepicker-yomtov' );
72+ } else if (' isChag' ) {
73+ classes .push (' datepicker-holiday' )
6574 }
6675
6776 return classes .join (' ' );
@@ -140,4 +149,47 @@ export default {
140149 }
141150 }
142151}
143- </script >
152+ </script >
153+ <style lang="scss" scoped>
154+ /* !
155+ * Based on vue2-calendar v2.1.4
156+ * (c) 2018 Terry <[email protected] > 157+ * https://github.com/icai/vue2-calendar#readme
158+ */
159+ .month-container {
160+ width : 218px ;
161+ float : left ;
162+ }
163+ .month-body {
164+ padding : 10px 10px ;
165+ text-align : center ;
166+
167+ span {
168+ display : inline-block ;
169+ width : 28px ;
170+ line-height : 28px ;
171+ height : 28px ;
172+ text-align : center ;
173+
174+ .dayOfWeekLabels & {
175+ font-weight : bold ;
176+ }
177+ & .day-cell {
178+ cursor : pointer ;
179+
180+ & :hover {
181+ background-color : #eeeeee ;
182+ }
183+
184+ & .gray {
185+ color : #999 ;
186+ }
187+ & .active :hover ,
188+ & .active {
189+ background : #3276b1 ;
190+ color : white ;
191+ }
192+ }
193+ }
194+ }
195+ </style >
0 commit comments