update TimePicker

update TimePicker
This commit is contained in:
梁灏 2016-12-26 15:04:02 +08:00
parent 9d844d5318
commit c1abaed980
3 changed files with 38 additions and 29 deletions

View file

@ -37,7 +37,11 @@
value: '', value: '',
hours: 0, hours: 0,
minutes: 0, minutes: 0,
seconds: 0 seconds: 0,
disabledHours: [],
disabledMinutes: [],
disabledSeconds: [],
hideDisabledOptions: false
}; };
}, },
computed: { computed: {
@ -51,11 +55,11 @@
newVal = new Date(newVal); newVal = new Date(newVal);
if (!isNaN(newVal)) { if (!isNaN(newVal)) {
this.handleChange({ this.handleChange({
hours: date.getHours(), hours: newVal.getHours(),
minutes: date.getMinutes(), minutes: newVal.getMinutes(),
seconds: date.getSeconds() seconds: newVal.getSeconds()
}); });
this.$nextTick(_ => this.scrollTop()); this.$nextTick(() => this.scrollTop());
} }
} }
}, },

View file

@ -1,32 +1,11 @@
import Picker from '../picker.vue'; import Picker from '../picker.vue';
import TimePanel from '../panel/time.vue'; import TimePanel from '../panel/time.vue';
import Options from '../time-mixins';
export default { export default {
mixins: [Picker], mixins: [Picker, Options],
props: { props: {
value: {}, value: {}
disabledHours: {
type: Array,
default () {
return [];
}
},
disabledMinutes: {
type: Array,
default () {
return [];
}
},
disabledSeconds: {
type: Array,
default () {
return [];
}
},
hideDisabledOptions: {
type: Boolean,
default: false
}
}, },
data () { data () {
return { return {

View file

@ -0,0 +1,26 @@
export default {
props: {
disabledHours: {
type: Array,
default () {
return [];
}
},
disabledMinutes: {
type: Array,
default () {
return [];
}
},
disabledSeconds: {
type: Array,
default () {
return [];
}
},
hideDisabledOptions: {
type: Boolean,
default: false
}
}
};