2
0
mirror of https://github.com/tenrok/vue2-datepicker.git synced 2026-06-25 04:30:36 +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
+2 -1
View File
@@ -112,7 +112,7 @@ You can also override some of the default locale by `lang`.
### Props ### Props
| Prop | Description | Type | Default | | Prop | Description | Type | Default |
| ------------------- | ---------------------------------------------- | ------------------------------------------- | -------------- | | ------------------- | ------------------------------------------------ | ------------------------------------------- | -------------- |
| type | select the type of picker | date \|datetime\|year\|month\|time\|week | 'date' | | type | select the type of picker | date \|datetime\|year\|month\|time\|week | 'date' |
| range | if true, pick the range date | `boolean` | false | | range | if true, pick the range date | `boolean` | false |
| format | to set the date format. similar to moment.js | [token](#token) | 'YYYY-MM-DD' | | format | to set the date format. similar to moment.js | [token](#token) | 'YYYY-MM-DD' |
@@ -153,6 +153,7 @@ You can also override some of the default locale by `lang`.
| time-title-format | format of the time header | [token](#token) | 'YYYY-MM-DD' | | 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 | | time-picker-options | set fixed time list to select | [time-picker-options](#time-picker-options) | null |
| prefix-class | set prefix class | `string` | 'mx' | | prefix-class | set prefix class | `string` | 'mx' |
| scroll-duration | set the duration of scroll when hour is selected | `number` | 100 |
#### Token #### Token
+1
View File
@@ -151,6 +151,7 @@ import 'vue2-datepicker/locale/zh-cn';
| time-title-format | 时间面板头部的格式化 | [token](#token) | 'YYYY-MM-DD' | | time-title-format | 时间面板头部的格式化 | [token](#token) | 'YYYY-MM-DD' |
| time-picker-options | 设置固定时间去选择 | [time-picker-options](#time-picker-options) | null | | time-picker-options | 设置固定时间去选择 | [time-picker-options](#time-picker-options) | null |
| prefix-class | 设置 class 的前缀 | `string` | 'mx' | | prefix-class | 设置 class 的前缀 | `string` | 'mx' |
| scroll-duration | 设置滚动时候当选中小时的时候 | `number` | 100 |
#### Token #### Token
+5 -1
View File
@@ -74,6 +74,10 @@ export default {
}, },
props: { props: {
date: Date, date: Date,
scrollDuration: {
type: Number,
default: 100,
},
getClasses: { getClasses: {
type: Function, type: Function,
default: () => [], default: () => [],
@@ -125,7 +129,7 @@ export default {
date: { date: {
handler() { handler() {
this.$nextTick(() => { this.$nextTick(() => {
this.scrollToSelected(100); this.scrollToSelected(this.scrollDuration);
}); });
}, },
}, },
+5
View File
@@ -28,6 +28,7 @@
:hour-step="hourStep" :hour-step="hourStep"
:minute-step="minuteStep" :minute-step="minuteStep"
:second-step="secondStep" :second-step="secondStep"
:scroll-duration="scrollDuration"
v-bind="ShowHourMinuteSecondAMPM" v-bind="ShowHourMinuteSecondAMPM"
@select="handleSelect" @select="handleSelect"
></list-columns> ></list-columns>
@@ -114,6 +115,10 @@ export default {
type: Boolean, type: Boolean,
default: undefined, default: undefined,
}, },
scrollDuration: {
type: Number,
default: 100,
},
}, },
computed: { computed: {
innerValue() { innerValue() {