|
1 | 1 | /*!
|
2 |
| - * vue-virtual-scroll-list v2.2.7 |
| 2 | + * vue-virtual-scroll-list v2.2.8 |
3 | 3 | * open source under the MIT license
|
4 | 4 | * https://github.com/tangbc/vue-virtual-scroll-list#readme
|
5 | 5 | */
|
|
683 | 683 | // return current scroll offset
|
684 | 684 | getOffset: function getOffset() {
|
685 | 685 | if (this.pageMode) {
|
686 |
| - return document.documentElement[this.directionKey]; |
| 686 | + return document.documentElement[this.directionKey] || document.body[this.directionKey]; |
687 | 687 | } else {
|
688 | 688 | var root = this.$refs.root;
|
689 | 689 | return root ? Math.ceil(root[this.directionKey]) : 0;
|
|
694 | 694 | var key = this.isHorizontal ? 'clientWidth' : 'clientHeight';
|
695 | 695 |
|
696 | 696 | if (this.pageMode) {
|
697 |
| - return document.documentElement[key]; |
| 697 | + return document.documentElement[key] || document.body[key]; |
698 | 698 | } else {
|
699 | 699 | var root = this.$refs.root;
|
700 |
| - return root ? root[key] : 0; |
| 700 | + return root ? Math.ceil(root[key]) : 0; |
701 | 701 | }
|
702 | 702 | },
|
703 | 703 | // return all scroll size
|
704 | 704 | getScrollSize: function getScrollSize() {
|
705 | 705 | var key = this.isHorizontal ? 'scrollWidth' : 'scrollHeight';
|
706 | 706 |
|
707 | 707 | if (this.pageMode) {
|
708 |
| - return document.documentElement[key]; |
| 708 | + return document.documentElement[key] || document.body[key]; |
709 | 709 | } else {
|
710 | 710 | var root = this.$refs.root;
|
711 |
| - return root ? root[key] : 0; |
| 711 | + return root ? Math.ceil(root[key]) : 0; |
712 | 712 | }
|
713 | 713 | },
|
714 | 714 | // set current scroll position to a expectant offset
|
715 | 715 | scrollToOffset: function scrollToOffset(offset) {
|
716 | 716 | if (this.pageMode) {
|
| 717 | + document.body[this.directionKey] = offset; |
717 | 718 | document.documentElement[this.directionKey] = offset;
|
718 | 719 | } else {
|
719 | 720 | var root = this.$refs.root;
|
|
0 commit comments