由原来的这种形式
变成这种形式
注意日期选择后时间是会自动提前一天的,下面的方法会弥补这个bug
const dateFormate = computed(() => {
return disabledRangeDate.value.map((date) => {
const currentDate = new Date(date);
currentDate.setDate(currentDate.getDate() + 1);
return currentDate.toISOString().split('T')[0];
});
});
- 这里面的disabledRangeDate使我们需要修改的格式,也就是使用
v-model
绑定在el-data-picker上的数据 - dateFormate是我们转换后的日期格式
- 可以选择不使用计算属性,可以写成方法