@@ -21,11 +21,13 @@ $ npm install vuejs-datepicker --save
2121``` javascript
2222import Datepicker from ' vuejs-datepicker' ;
2323
24- Vue .component (' my-component' , {
25- components: {
26- Datepicker
27- }
28- });
24+ export default {
25+ // ...
26+ components: {
27+ Datepicker
28+ }
29+ // ...
30+ }
2931```
3032
3133
@@ -40,7 +42,7 @@ Vue.component('my-component', {
4042``` html
4143<script >
4244var state = {
43- date: new Date (2016 , 9 , 16 )
45+ date: new Date (2016 , 9 , 16 )
4446}
4547 </script >
4648<datepicker :value =" state.date" ></datepicker >
@@ -55,7 +57,7 @@ Use `v-model` for two-way binding
5557```
5658Emits events
5759``` html
58- <datepicker v-on: selected =" doSomethingInParentComponentFunction" v-on: opened =" datepickerOpenedFunction" v-on: closed =" datepickerClosedFunction" >
60+ <datepicker @ selected =" doSomethingInParentComponentFunction" @ opened =" datepickerOpenedFunction" @ closed =" datepickerClosedFunction" >
5961```
6062Inline always open version
6163``` html
@@ -151,34 +153,34 @@ Dates can be disabled in a number of ways.
151153``` html
152154<script >
153155var state = {
154- disabled: {
155- to: new Date (2016 , 0 , 5 ), // Disable all dates up to specific date
156- from: new Date (2016 , 0 , 26 ), // Disable all dates after specific date
157- days: [6 , 0 ], // Disable Saturday's and Sunday's
158- daysOfMonth: [29 , 30 , 31 ], // Disable 29th, 30th and 31st of each month
159- dates: [ // Disable an array of dates
160- new Date (2016 , 9 , 16 ),
161- new Date (2016 , 9 , 17 ),
162- new Date (2016 , 9 , 18 )
163- ],
164- ranges: [{ // Disable dates in given ranges (exclusive).
165- from: new Date (2016 , 11 , 25 ),
166- to: new Date (2016 , 11 , 30 )
167- }, {
168- from: new Date (2017 , 1 , 12 ),
169- to: new Date (2017 , 2 , 25 )
170- }],
171- // a custom function that returns true if the date is disabled
172- // this can be used for wiring you own logic to disable a date if none
173- // of the above conditions serve your purpose
174- // this function should accept a date and return true if is disabled
175- customPredictor : function (date ) {
176- // disables the date if it is a multiple of 5
177- if (date .getDate () % 5 == 0 ){
178- return true
179- }
180- }
156+ disabled: {
157+ to: new Date (2016 , 0 , 5 ), // Disable all dates up to specific date
158+ from: new Date (2016 , 0 , 26 ), // Disable all dates after specific date
159+ days: [6 , 0 ], // Disable Saturday's and Sunday's
160+ daysOfMonth: [29 , 30 , 31 ], // Disable 29th, 30th and 31st of each month
161+ dates: [ // Disable an array of dates
162+ new Date (2016 , 9 , 16 ),
163+ new Date (2016 , 9 , 17 ),
164+ new Date (2016 , 9 , 18 )
165+ ],
166+ ranges: [{ // Disable dates in given ranges (exclusive).
167+ from: new Date (2016 , 11 , 25 ),
168+ to: new Date (2016 , 11 , 30 )
169+ }, {
170+ from: new Date (2017 , 1 , 12 ),
171+ to: new Date (2017 , 2 , 25 )
172+ }],
173+ // a custom function that returns true if the date is disabled
174+ // this can be used for wiring you own logic to disable a date if none
175+ // of the above conditions serve your purpose
176+ // this function should accept a date and return true if is disabled
177+ customPredictor : function (date ) {
178+ // disables the date if it is a multiple of 5
179+ if (date .getDate () % 5 == 0 ){
180+ return true
181+ }
181182 }
183+ }
182184}
183185 </script >
184186<datepicker :disabled =" state.disabled" ></datepicker >
@@ -193,28 +195,28 @@ dates to highlight.
193195``` html
194196<script >
195197var state = {
196- highlighted: {
197- to: new Date (2016 , 0 , 5 ), // Highlight all dates up to specific date
198- from: new Date (2016 , 0 , 26 ), // Highlight all dates after specific date
199- days: [6 , 0 ], // Highlight Saturday's and Sunday's
200- daysOfMonth: [15 , 20 , 31 ], // Highlight 15th, 20th and 31st of each month
201- dates: [ // Highlight an array of dates
202- new Date (2016 , 9 , 16 ),
203- new Date (2016 , 9 , 17 ),
204- new Date (2016 , 9 , 18 )
205- ],
206- // a custom function that returns true of the date is highlighted
207- // this can be used for wiring you own logic to highlight a date if none
208- // of the above conditions serve your purpose
209- // this function should accept a date and return true if is highlighted
210- customPredictor : function (date ) {
211- // highlights the date if it is a multiple of 4
212- if (date .getDate () % 4 == 0 ){
213- return true
214- }
215- },
216- includeDisabled: true // Highlight disabled dates
217- }
198+ highlighted: {
199+ to: new Date (2016 , 0 , 5 ), // Highlight all dates up to specific date
200+ from: new Date (2016 , 0 , 26 ), // Highlight all dates after specific date
201+ days: [6 , 0 ], // Highlight Saturday's and Sunday's
202+ daysOfMonth: [15 , 20 , 31 ], // Highlight 15th, 20th and 31st of each month
203+ dates: [ // Highlight an array of dates
204+ new Date (2016 , 9 , 16 ),
205+ new Date (2016 , 9 , 17 ),
206+ new Date (2016 , 9 , 18 )
207+ ],
208+ // a custom function that returns true of the date is highlighted
209+ // this can be used for wiring you own logic to highlight a date if none
210+ // of the above conditions serve your purpose
211+ // this function should accept a date and return true if is highlighted
212+ customPredictor : function (date ) {
213+ // highlights the date if it is a multiple of 4
214+ if (date .getDate () % 4 == 0 ){
215+ return true
216+ }
217+ },
218+ includeDisabled: true // Highlight disabled dates
219+ }
218220}
219221 </script >
220222<datepicker :highlighted =" state.highlighted" ></datepicker >
0 commit comments