admin管理员组文章数量:1384158
I am using vue-hotel-datepicker
ponent for date.Its working fine , but the issues is getting value when date has been change i want the date object in js
code so that i can do some work.Any suggestion and help will be appreciated
Here is my code
VUE
<DatePicker DatePickerID="DatePickerID3"
:disabledDaysOfWeek="['Monday']"
:value="date" placeholder="RentalDays"
:hoveringTooltip="false"
:endDate="new Date(2017, 9, 5)"
/>
JS
<script>
import Datepicker from 'vuejs-datepicker';
import HotelDatePicker from 'vue-hotel-datepicker'
export default {
data() {
return {
// date: new Date(2016, 9, 16)
date: '',
cdate: "",
RentalDays: "Rent-in ► Rent-out",
startdate:""
}
},
created () {
console.log("DATE",this.date);
}
,
ponents: {
'DatePicker': HotelDatePicker,
},
methods: {
getDate(date) {
console.log("current date", date);
}
},
watch: {
value: function () {
console.log("DATE Value");
}
}
}
</script>
I am using vue-hotel-datepicker
ponent for date.Its working fine , but the issues is getting value when date has been change i want the date object in js
code so that i can do some work.Any suggestion and help will be appreciated
https://github./krystalcampioni/vue-hotel-datepicker#i18n
Here is my code
VUE
<DatePicker DatePickerID="DatePickerID3"
:disabledDaysOfWeek="['Monday']"
:value="date" placeholder="RentalDays"
:hoveringTooltip="false"
:endDate="new Date(2017, 9, 5)"
/>
JS
<script>
import Datepicker from 'vuejs-datepicker';
import HotelDatePicker from 'vue-hotel-datepicker'
export default {
data() {
return {
// date: new Date(2016, 9, 16)
date: '',
cdate: "",
RentalDays: "Rent-in ► Rent-out",
startdate:""
}
},
created () {
console.log("DATE",this.date);
}
,
ponents: {
'DatePicker': HotelDatePicker,
},
methods: {
getDate(date) {
console.log("current date", date);
}
},
watch: {
value: function () {
console.log("DATE Value");
}
}
}
</script>
Share
Improve this question
asked Aug 8, 2017 at 7:41
Wasiq MuhammadWasiq Muhammad
3,1383 gold badges18 silver badges30 bronze badges
2 Answers
Reset to default 4If you use vue-hotel-datepicker
there is a list of events on docs: https://github./krystalcampioni/vue-hotel-datepicker#events,
You can use: period-selected
, as a params you will get: Mouse Event, check-in, check-out. Also, you have check-in-changed
and check-out-changed
with their arguments respectively.
<HotelDatePicker
:showPrice="true"
priceSymbol="€"
:periodDates="periodDates"
@period-selected="getDates"
/>
methods: {
getDate(event,checkIn,checkOut) {
console.log(date)
console.log(checkIn);
console.log(checkOut;
}
},
"If you select a period you will see arguments as bellow"
// PointerEvent {isTrusted: true, pointerId: 1, width: 1, height: 1, pressure: 0, …}
// Tue Sep 21 2021 00:00:00 GMT+0200 (Central European Summer Time)
// Sat Sep 25 2021 00:00:00 GMT+0200 (Central European Summer Time)
Components municate with events. Your datepicker emits a dateChanged event, so you need v-on:dateChanged="getDate"
in the tag where you call your ponent. So...
<DatePicker DatePickerID="DatePickerID3"
:disabledDaysOfWeek="['Monday']"
:value="date" placeholder="RentalDays"
:hoveringTooltip="false"
:endDate="new Date(2017, 9, 5)"
v-on:dateChanged="getDate"
/>
本文标签: javascriptIssue in getting DatePicker value VueJSStack Overflow
版权声明:本文标题:javascript - Issue in getting DatePicker value VueJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744450341a2606715.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论