v 日期选择器在选择单个日期时不调用更改事件
v date picker not calling change event when single date is picked
我正在尝试检测日期选择器的更改事件。当用户从日历中选择多天时,它工作正常。但是,如果用户选择单个日期,则不会触发更改方法。我的尝试如下。
<v-date-picker
v-model="dates"
range
color="primary"
id="calendar1"
@change="sendRange"
></v-date-picker>
sendRange(): void {
console.log("executed") // executed for multiple date range selection only
}
我在哪里弄错了,我该如何解决?
使用@input
选择器处于范围模式时选择单个日期时将调用它
Reactive date picker emits input even when any part of the date (year/month/day) changes, but change event is emitted only when the day (for date pickers) or month (for month pickers) changes. If range prop is set, date picker emits change when both [from, to] are selected.
查看文档
我正在尝试检测日期选择器的更改事件。当用户从日历中选择多天时,它工作正常。但是,如果用户选择单个日期,则不会触发更改方法。我的尝试如下。
<v-date-picker
v-model="dates"
range
color="primary"
id="calendar1"
@change="sendRange"
></v-date-picker>
sendRange(): void {
console.log("executed") // executed for multiple date range selection only
}
我在哪里弄错了,我该如何解决?
使用@input
选择器处于范围模式时选择单个日期时将调用它
Reactive date picker emits input even when any part of the date (year/month/day) changes, but change event is emitted only when the day (for date pickers) or month (for month pickers) changes. If range prop is set, date picker emits change when both [from, to] are selected.
查看文档