TimePicker
TimePicker
This commit is contained in:
parent
d70cad45ec
commit
915055614b
1 changed files with 24 additions and 11 deletions
|
@ -156,8 +156,11 @@
|
||||||
this.$emit('on-change', data);
|
this.$emit('on-change', data);
|
||||||
|
|
||||||
const from = this.$els[type].scrollTop;
|
const from = this.$els[type].scrollTop;
|
||||||
|
const to = 24 * this.getScrollIndex(type, cell.text);
|
||||||
let index = cell.text;
|
scrollTop(this.$els[type], from, to, 500);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getScrollIndex (type, index) {
|
||||||
const Type = firstUpperCase(type);
|
const Type = firstUpperCase(type);
|
||||||
const disabled = this[`disabled${Type}`];
|
const disabled = this[`disabled${Type}`];
|
||||||
if (disabled.length && this.hideDisabledOptions) {
|
if (disabled.length && this.hideDisabledOptions) {
|
||||||
|
@ -165,11 +168,21 @@
|
||||||
disabled.forEach(item => item <= index ? _count++ : '');
|
disabled.forEach(item => item <= index ? _count++ : '');
|
||||||
index -= _count;
|
index -= _count;
|
||||||
}
|
}
|
||||||
|
return index;
|
||||||
const to = 24 * index;
|
},
|
||||||
scrollTop(this.$els[type], from, to, 500);
|
updateScroll () {
|
||||||
}
|
const times = ['hours', 'minutes', 'seconds'];
|
||||||
|
times.forEach(type => this.$els[type].style.overflow = 'hidden');
|
||||||
|
this.$nextTick(() => {
|
||||||
|
times.forEach(type => {
|
||||||
|
this.$els[type].scrollTop = 24 * this.getScrollIndex(type, this[type]);
|
||||||
|
});
|
||||||
|
this.$nextTick(() => times.forEach(type => this.$els[type].style.overflow = 'auto'));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
compiled () {
|
||||||
|
this.updateScroll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
Loading…
Add table
Reference in a new issue