2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-16 11:40:35 +03:00

feat: add the prop scroll-duration (#475)

This commit is contained in:
mengxiong10
2020-05-31 11:23:31 +08:00
parent 1cdfe9d022
commit 051ad89c24
4 changed files with 54 additions and 43 deletions
+43 -42
View File
@@ -111,48 +111,49 @@ You can also override some of the default locale by `lang`.
### Props
| Prop | Description | Type | Default |
| ------------------- | ---------------------------------------------- | ------------------------------------------- | -------------- |
| type | select the type of picker | date \|datetime\|year\|month\|time\|week | 'date' |
| range | if true, pick the range date | `boolean` | false |
| format | to set the date format. similar to moment.js | [token](#token) | 'YYYY-MM-DD' |
| value-type | data type of the binding value | [value-type](#value-type) | 'date' |
| default-value | default date of the calendar | `Date` | new Date() |
| lang | override the default locale | `object` | |
| placeholder | input placeholder text | `string` | '' |
| editable | whether the input is editable | `boolean` | true |
| clearable | if false, don't show the clear icon | `boolean` | true |
| confirm | if true, need click the button to change value | `boolean` | false |
| confirm-text | the text of confirm button | `string` | 'OK' |
| disabled | disable the component | `boolean` | false |
| disabled-date | specify the date that cannot be selected | `(date) => boolean` | - |
| disabled-time | specify the time that cannot be selected | `(date) => boolean` | - |
| append-to-body | append the popup to body | `boolean` | true |
| inline | without input | `boolean` | false |
| input-class | input classname | `string` | 'mx-input' |
| input-attr | input attrs(eg: { name: 'date', id: 'foo'}) | `object` | — |
| open | open state of picker | `boolean` | - |
| popup-style | popup style | `object` | — |
| popup-class | popup classes | | — |
| shortcuts | set shortcuts to select | `Array<{text, onClick}>` | - |
| title-format | format of the tooltip in calendar cell | [token](#token) | 'YYYY-MM-DD' |
| partial-update | whether update date when select year or month | `boolean` | false |
| range-separator | text of range separator | `string` | ' ~ ' |
| show-week-number | determine whether show week number | `boolean` | false |
| hour-step | interval between hours in time picker | 1 - 60 | 1 |
| minute-step | interval between minutes in time picker | 1 - 60 | 1 |
| second-step | interval between seconds in time picker | 1 - 60 | 1 |
| hour-options | custom hour column | `Array<number>` | - |
| minute-options | custom minute column | `Array<number>` | - |
| second-options | custom second column | `Array<number>` | - |
| show-hour | whether show hour column | `boolean` | base on format |
| show-minute | whether show minute column | `boolean` | base on format |
| show-second | whether show second column | `boolean` | base on format |
| use12h | whether show ampm column | `boolean` | base on format |
| show-time-header | whether show header of time picker | `boolean` | false |
| time-title-format | format of the time header | [token](#token) | 'YYYY-MM-DD' |
| time-picker-options | set fixed time list to select | [time-picker-options](#time-picker-options) | null |
| prefix-class | set prefix class | `string` | 'mx' |
| Prop | Description | Type | Default |
| ------------------- | ------------------------------------------------ | ------------------------------------------- | -------------- |
| type | select the type of picker | date \|datetime\|year\|month\|time\|week | 'date' |
| range | if true, pick the range date | `boolean` | false |
| format | to set the date format. similar to moment.js | [token](#token) | 'YYYY-MM-DD' |
| value-type | data type of the binding value | [value-type](#value-type) | 'date' |
| default-value | default date of the calendar | `Date` | new Date() |
| lang | override the default locale | `object` | |
| placeholder | input placeholder text | `string` | '' |
| editable | whether the input is editable | `boolean` | true |
| clearable | if false, don't show the clear icon | `boolean` | true |
| confirm | if true, need click the button to change value | `boolean` | false |
| confirm-text | the text of confirm button | `string` | 'OK' |
| disabled | disable the component | `boolean` | false |
| disabled-date | specify the date that cannot be selected | `(date) => boolean` | - |
| disabled-time | specify the time that cannot be selected | `(date) => boolean` | - |
| append-to-body | append the popup to body | `boolean` | true |
| inline | without input | `boolean` | false |
| input-class | input classname | `string` | 'mx-input' |
| input-attr | input attrs(eg: { name: 'date', id: 'foo'}) | `object` | — |
| open | open state of picker | `boolean` | - |
| popup-style | popup style | `object` | — |
| popup-class | popup classes | | — |
| shortcuts | set shortcuts to select | `Array<{text, onClick}>` | - |
| title-format | format of the tooltip in calendar cell | [token](#token) | 'YYYY-MM-DD' |
| partial-update | whether update date when select year or month | `boolean` | false |
| range-separator | text of range separator | `string` | ' ~ ' |
| show-week-number | determine whether show week number | `boolean` | false |
| hour-step | interval between hours in time picker | 1 - 60 | 1 |
| minute-step | interval between minutes in time picker | 1 - 60 | 1 |
| second-step | interval between seconds in time picker | 1 - 60 | 1 |
| hour-options | custom hour column | `Array<number>` | - |
| minute-options | custom minute column | `Array<number>` | - |
| second-options | custom second column | `Array<number>` | - |
| show-hour | whether show hour column | `boolean` | base on format |
| show-minute | whether show minute column | `boolean` | base on format |
| show-second | whether show second column | `boolean` | base on format |
| use12h | whether show ampm column | `boolean` | base on format |
| show-time-header | whether show header of time picker | `boolean` | false |
| time-title-format | format of the time header | [token](#token) | 'YYYY-MM-DD' |
| time-picker-options | set fixed time list to select | [time-picker-options](#time-picker-options) | null |
| prefix-class | set prefix class | `string` | 'mx' |
| scroll-duration | set the duration of scroll when hour is selected | `number` | 100 |
#### Token
+1
View File
@@ -151,6 +151,7 @@ import 'vue2-datepicker/locale/zh-cn';
| time-title-format | 时间面板头部的格式化 | [token](#token) | 'YYYY-MM-DD' |
| time-picker-options | 设置固定时间去选择 | [time-picker-options](#time-picker-options) | null |
| prefix-class | 设置 class 的前缀 | `string` | 'mx' |
| scroll-duration | 设置滚动时候当选中小时的时候 | `number` | 100 |
#### Token
+5 -1
View File
@@ -74,6 +74,10 @@ export default {
},
props: {
date: Date,
scrollDuration: {
type: Number,
default: 100,
},
getClasses: {
type: Function,
default: () => [],
@@ -125,7 +129,7 @@ export default {
date: {
handler() {
this.$nextTick(() => {
this.scrollToSelected(100);
this.scrollToSelected(this.scrollDuration);
});
},
},
+5
View File
@@ -28,6 +28,7 @@
:hour-step="hourStep"
:minute-step="minuteStep"
:second-step="secondStep"
:scroll-duration="scrollDuration"
v-bind="ShowHourMinuteSecondAMPM"
@select="handleSelect"
></list-columns>
@@ -114,6 +115,10 @@ export default {
type: Boolean,
default: undefined,
},
scrollDuration: {
type: Number,
default: 100,
},
},
computed: {
innerValue() {