Vue.js Datepicker Component

In this post we will show you Best way to implement Vue.js Date Picker with Time, hear for Datepicker as a simple Vue.js component with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

A simple datepicker in VueJS

Vue Datepicker simple supports all the disabling of dates, simple inline mode and translations.

Include External Libs

jquery.min.js
vue.min.js
bootstrap.min.css
bootstrap.min.js
bootstrap-datepicker3.min.css
bootstrap-datepicker.min.js
<script src="http://vuejs.org/js/vue.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">

index.html

A datepicker simple Vue component.more Compatible with Vue 2.x version’s.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vuejs simple datepicker Example</title>
</head>
<body id="liveApp">
<h1>Vuejs simple datepicker Example</h1>
<input type="text" v-datepicker="livedt" />
<button v-on="click:CheckDate">CheckDate!</button>
</body>
</html>

index.js

Vue.directive('datepicker', {
bind: function () {
var vm = this.vm;
var key = this.expression;
//init datepicker in vuejs
$(this.el).datepicker({
onSelect: function (date) {
vm.$set(key, date);
}
});
},
update: function (val) {
$(this.el).datepicker('setDate', val);
}
});

var v =new Vue({
el:"#liveApp",
data:{
livedt: '04/29/2018'
},
methods:{
CheckDate:function(){
console.log(this.livedt);
}
}
});

I hope you have Got What is Date picker as a simple Vue.js component And how it works.


#vue #vuejs 

Vue.js Datepicker Component
1.05 GEEK