소스 검색

TimePicker: adjust number position, fixed #4323

pengchongfu 8 년 전
부모
커밋
ed4b666167
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      packages/date-picker/src/basic/time-spinner.vue

+ 6 - 0
packages/date-picker/src/basic/time-spinner.vue

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