Contents
- Start view
- Depth view
Having trouble getting help?
Contact Support
Contact Support
View in Vue Datepicker component
11 Jun 20244 minutes to read
The Vue DatePicker has the following predefined views that provides a flexible way to navigate back and forth to select the date.
View | Description |
---|---|
month (default) | Displays the days in a month |
year | Displays the months in a year |
decade | Displays the years in a decade |
Start view
You can use the start
property to define the initial rendering view.
The following example demonstrates how to create a DatePicker with decade
as initial rendering view.
<template>
<div id="app">
<div class='wrap'>
<ejs-datepicker id='datepicker' start='Decade' placeholder='Select a date'></ejs-datepicker>
</div>
</div>
</template>
<script setup>
import { DatePickerComponent as EjsDatepicker } from "@syncfusion/ej2-vue-calendars";
</script>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
.wrap {
margin: 35px auto;
width: 240px;
}
</style>
<template>
<div id="app">
<div class='wrap'>
<ejs-datepicker id='datepicker' start='Decade' placeholder='Select a date'></ejs-datepicker>
</div>
</div>
</template>
<script>
import { DatePickerComponent } from "@syncfusion/ej2-vue-calendars";
export default {
name: "App",
components: {
"ejs-datepicker": DatePickerComponent
}
}
</script>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
.wrap {
margin: 35px auto;
width: 240px;
}
</style>
Depth view
Define the depth
property to control the view navigation.
Always the depth view has to be smaller than the start view, otherwise the view restriction will be not restricted.
The following example demonstrates how to create a DatePicker that allows users to select a month.
<template>
<div id="app">
<div class='wrap'>
<ejs-datepicker id='datepicker' start='Decade' depth='Year' placeholder='Select a date'></ejs-datepicker>
</div>
</div>
</template>
<script setup>
import { DatePickerComponent as EjsDatepicker } from "@syncfusion/ej2-vue-calendars";
</script>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
.wrap {
margin: 35px auto;
width: 240px;
}
</style>
<template>
<div id="app">
<div class='wrap'>
<ejs-datepicker id='datepicker' start='Decade' depth='Year' placeholder='Select a date'></ejs-datepicker>
</div>
</div>
</template>
<script>
import { DatePickerComponent } from "@syncfusion/ej2-vue-calendars";
export default {
name: "App",
components: {
"ejs-datepicker": DatePickerComponent
}
}
</script>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
@import '../node_modules/@syncfusion/ej2-buttons/styles/material.css';
@import '../node_modules/@syncfusion/ej2-inputs/styles/material.css';
@import '../node_modules/@syncfusion/ej2-popups/styles/material.css';
@import "../node_modules/@syncfusion/ej2-vue-calendars/styles/material.css";
.wrap {
margin: 35px auto;
width: 240px;
}
</style>