|
1 | 1 | /*! |
2 | | - * vue-virtual-scroll-list v2.0.9 |
| 2 | + * vue-virtual-scroll-list v2.1.0 |
3 | 3 | * open source under the MIT license |
4 | 4 | * https://github.com/tangbc/vue-virtual-scroll-list#readme |
5 | 5 | */ |
|
534 | 534 | mixins: [Wrapper], |
535 | 535 | props: ItemProps, |
536 | 536 | render: function render(h) { |
537 | | - var itemProps = this.extraProps || {}; |
| 537 | + var component = this.component, |
| 538 | + _this$itemProps = this.itemProps, |
| 539 | + itemProps = _this$itemProps === void 0 ? {} : _this$itemProps; |
538 | 540 | itemProps.source = this.source; |
539 | 541 | return h(this.tag, { |
540 | 542 | role: 'item' |
541 | | - }, [h(this.component, { |
| 543 | + }, [h(component, { |
542 | 544 | props: itemProps |
543 | 545 | })]); |
544 | 546 | } |
|
548 | 550 | mixins: [Wrapper], |
549 | 551 | props: SlotProps, |
550 | 552 | render: function render(h) { |
| 553 | + var uniqueKey = this.uniqueKey; |
551 | 554 | return h(this.tag, { |
552 | 555 | attrs: { |
553 | | - role: this.uniqueKey |
| 556 | + role: uniqueKey |
554 | 557 | } |
555 | 558 | }, this.$slots["default"]); |
556 | 559 | } |
|
744 | 747 | // so those components that are reused will not trigger lifecycle mounted |
745 | 748 | getRenderSlots: function getRenderSlots(h) { |
746 | 749 | var slots = []; |
747 | | - var start = this.range.start; |
748 | | - var end = this.range.end; |
| 750 | + var _this$range = this.range, |
| 751 | + start = _this$range.start, |
| 752 | + end = _this$range.end; |
| 753 | + var dataSources = this.dataSources, |
| 754 | + dataKey = this.dataKey, |
| 755 | + itemClass = this.itemClass, |
| 756 | + itemTag = this.itemTag, |
| 757 | + isHorizontal = this.isHorizontal, |
| 758 | + extraProps = this.extraProps, |
| 759 | + dataComponent = this.dataComponent; |
749 | 760 |
|
750 | 761 | for (var index = start; index <= end; index++) { |
751 | | - var dataSource = this.dataSources[index]; |
| 762 | + var dataSource = dataSources[index]; |
752 | 763 |
|
753 | 764 | if (dataSource) { |
754 | | - if (dataSource[this.dataKey]) { |
| 765 | + if (dataSource[dataKey]) { |
755 | 766 | slots.push(h(Item, { |
756 | | - "class": this.itemClass, |
| 767 | + "class": itemClass, |
757 | 768 | props: { |
758 | | - tag: this.itemTag, |
| 769 | + tag: itemTag, |
759 | 770 | event: EVENT_TYPE.ITEM, |
760 | | - horizontal: this.isHorizontal, |
761 | | - uniqueKey: dataSource[this.dataKey], |
| 771 | + horizontal: isHorizontal, |
| 772 | + uniqueKey: dataSource[dataKey], |
762 | 773 | source: dataSource, |
763 | | - extraProps: this.extraProps, |
764 | | - component: this.dataComponent |
| 774 | + extraProps: extraProps, |
| 775 | + component: dataComponent |
765 | 776 | } |
766 | 777 | })); |
767 | 778 | } else { |
768 | | - console.warn("Cannot get the data-key '".concat(this.dataKey, "' from data-sources.")); |
| 779 | + console.warn("Cannot get the data-key '".concat(dataKey, "' from data-sources.")); |
769 | 780 | } |
770 | 781 | } else { |
771 | 782 | console.warn("Cannot get the index '".concat(index, "' from data-sources.")); |
|
781 | 792 | var _this$$slots = this.$slots, |
782 | 793 | header = _this$$slots.header, |
783 | 794 | footer = _this$$slots.footer; |
784 | | - var _this$range = this.range, |
785 | | - padFront = _this$range.padFront, |
786 | | - padBehind = _this$range.padBehind; |
| 795 | + var _this$range2 = this.range, |
| 796 | + padFront = _this$range2.padFront, |
| 797 | + padBehind = _this$range2.padBehind; |
| 798 | + var rootTag = this.rootTag, |
| 799 | + headerClass = this.headerClass, |
| 800 | + headerTag = this.headerTag, |
| 801 | + wrapTag = this.wrapTag, |
| 802 | + wrapClass = this.wrapClass, |
| 803 | + footerClass = this.footerClass, |
| 804 | + footerTag = this.footerTag; |
787 | 805 | var padding = this.isHorizontal ? "0px ".concat(padBehind, "px 0px ").concat(padFront, "px") : "".concat(padFront, "px 0px ").concat(padBehind, "px"); |
788 | | - return h(this.rootTag, { |
| 806 | + return h(rootTag, { |
789 | 807 | ref: 'root', |
790 | 808 | on: { |
791 | 809 | '&scroll': this.onScroll |
792 | 810 | } |
793 | 811 | }, [// header slot |
794 | 812 | header ? h(Slot, { |
795 | | - "class": this.headerClass, |
| 813 | + "class": headerClass, |
796 | 814 | props: { |
797 | | - tag: this.headerTag, |
| 815 | + tag: headerTag, |
798 | 816 | event: EVENT_TYPE.SLOT, |
799 | 817 | uniqueKey: SLOT_TYPE.HEADER |
800 | 818 | } |
801 | 819 | }, header) : null, // main list |
802 | | - h(this.wrapTag, { |
803 | | - "class": this.wrapClass, |
| 820 | + h(wrapTag, { |
| 821 | + "class": wrapClass, |
804 | 822 | attrs: { |
805 | 823 | role: 'group' |
806 | 824 | }, |
|
809 | 827 | } |
810 | 828 | }, this.getRenderSlots(h)), // footer slot |
811 | 829 | footer ? h(Slot, { |
812 | | - "class": this.footerClass, |
| 830 | + "class": footerClass, |
813 | 831 | props: { |
814 | | - tag: this.footerTag, |
| 832 | + tag: footerTag, |
815 | 833 | event: EVENT_TYPE.SLOT, |
816 | 834 | uniqueKey: SLOT_TYPE.FOOTER |
817 | 835 | } |
|
0 commit comments