I'm having difficulty making settings for the component using jquery in vuejs2.
<div id="app">
<date-picker @update-date="updateDate" timepicker= "false" v-once></date-picker>
<p>{{ date }}</p>
</div>
<script>
Vue.component('date-picker', {
template: '<input/>',
props: [ 'timepicker' ],
mounted: function() {
var self = this;
$(this.$el).datetimepicker({
timepicker: this.timepicker,
onSelect: function(date) {
self.$emit('update-date', date);
}
});
},
beforeDestroy: function() {
$(this.$el).datetimepicker('hide').datetimepicker('destroy');
}
});
new Vue({
el: '#app',
data: {
date: null
},
methods: {
updateDate: function(date) {
this.date = date;
}
}
});