Releases: mengxiong10/vue2-datepicker
v3.0.1
v3.0.0
Bug Fixes
- localization (lang) is not used for date formatting
Features
-
Add week picker
<date-picer type="week" />
-
Add inline calendar without input
<date-picker inline />
-
Add prop
open
to control the state of popup -
Add select am/pm, when use12hours
-
Add event
open
andclose
-
Add
hourStep
/minuteStep
/secondStep
/showHour
/showMinute
/showSecond
/use12h
to time picker for more configuration
Breaking changes
-
Need to import style separately
-
Change the default language to English. And need to import file to change the language.
-
Range selection refactoring, you can select a range on one calendar now, and need to click twice to select a range each time.
-
Change slot
calendar-icon
toicon-calendar
. -
appendToBody
default value changes from false to true. -
Remove
not-before
andnot-after
, usedisabledDate
instead.<template> <date-picker :disabled-date="notBeforeToday"></date-picker> <date-picker :disabled-date="notAfterToday"></date-picker> </template> <script> export default { methods: { notBeforeToday(date) { const today = new Date(); today.setHours(0, 0, 0, 0); return date.getTime() < today.getTime(); }, notAfterToday(date) { const today = new Date(); today.setHours(0, 0, 0, 0); return date.getTime() > today.getTime(); }, }, }; </script>
-
Remove
width
, usestyle="{ width: "" }"
instead. -
modify
shortcuts
api.[ { text: 'today', onClick: () => new Date() // return a Date } ];
-
Remove prop
firstDayOfWeek
to locale.
修复bug
- 修复国际化没有应用到日期的格式
新功能
-
添加星期选择
<date-picer type="week" />
-
添加内联模式, 没有输入框
<date-picker inline />
-
添加
open
控制弹窗的状态 -
添加 am/pm 的选择, 当使用12小时制
-
添加事件
open
和close
-
添加
hourStep
/minuteStep
/secondStep
/showHour
/showMinute
/showSecond
/use12h
对时间选择更多的控制
不兼容更新
-
需要单独引入样式
-
修改默认语音是英文, 可以自行引入语言包
-
日期范围选择重构, 现在模式是可以在一个日历上面选择范围, 每次选择需要点击2次.
-
修改 slot
calendar-icon
为icon-calendar
. -
appendToBody
默认值修改为true. -
移除
not-before
和not-after
, 用disabledDate
代替.<template> <date-picker :disabled-date="notBeforeToday"></date-picker> <date-picker :disabled-date="notAfterToday"></date-picker> </template> <script> export default { methods: { notBeforeToday(date) { const today = new Date(); today.setHours(0, 0, 0, 0); return date.getTime() < today.getTime(); }, notAfterToday(date) { const today = new Date(); today.setHours(0, 0, 0, 0); return date.getTime() > today.getTime(); }, }, }; </script>
-
移除
width
, 用style="{ width: "" }"
代替. -
修改
shortcuts
, onClick函数返回一个日期. -
移除
firstDayOfWeek
到语言包