TimePicker: adjust number position, fixed #4323

pull/4447/head
pengchongfu 2017-04-24 19:39:15 +08:00 committed by 杨奕
parent e5d43972a8
commit ed4b666167
1 changed files with 6 additions and 0 deletions

View File

@ -53,6 +53,7 @@
<script type="text/babel"> <script type="text/babel">
import { getRangeHours } from '../util'; import { getRangeHours } from '../util';
import ElScrollbar from 'element-ui/packages/scrollbar'; import ElScrollbar from 'element-ui/packages/scrollbar';
import debounce from 'throttle-debounce/debounce';
export default { export default {
components: { ElScrollbar }, components: { ElScrollbar },
@ -132,6 +133,10 @@
}; };
}, },
created() {
this.debounceAjustElTop = debounce(100, type => this.ajustElTop(type, this[`${type}s`]));
},
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.bindScrollEvent(); this.bindScrollEvent();
@ -171,6 +176,7 @@
handleScroll(type) { handleScroll(type) {
const ajust = {}; const ajust = {};
ajust[`${type}s`] = Math.min(Math.floor((this[`${type}El`].scrollTop - 80) / 32 + 3), 59); ajust[`${type}s`] = Math.min(Math.floor((this[`${type}El`].scrollTop - 80) / 32 + 3), 59);
this.debounceAjustElTop(type);
this.$emit('change', ajust); this.$emit('change', ajust);
}, },