|
1 | 1 | /*!
|
2 |
| - * vue-virtual-scroll-list v2.2.0 |
| 2 | + * vue-virtual-scroll-list v2.2.4 |
3 | 3 | * open source under the MIT license
|
4 | 4 | * https://github.com/tangbc/vue-virtual-scroll-list#readme
|
5 | 5 | */
|
|
263 | 263 | }, {
|
264 | 264 | key: "getIndexOffset",
|
265 | 265 | value: function getIndexOffset(givenIndex) {
|
266 |
| - // we know this. |
267 | 266 | if (!givenIndex) {
|
268 | 267 | return 0;
|
269 | 268 | }
|
|
274 | 273 | for (var index = 0; index < givenIndex; index++) {
|
275 | 274 | // this.__getIndexOffsetCalls++
|
276 | 275 | indexSize = this.sizes.get(this.param.uniqueIds[index]);
|
277 |
| - offset = offset + (indexSize || this.getEstimateSize()); |
| 276 | + offset = offset + (typeof indexSize === 'number' ? indexSize : this.getEstimateSize()); |
278 | 277 | } // remember last calculate index
|
279 | 278 |
|
280 | 279 |
|
|
474 | 473 | },
|
475 | 474 | footerStyle: {
|
476 | 475 | type: Object
|
| 476 | + }, |
| 477 | + itemScopedSlots: { |
| 478 | + type: Object |
477 | 479 | }
|
478 | 480 | };
|
479 | 481 | var ItemProps = {
|
|
496 | 498 | type: [Object, Function]
|
497 | 499 | },
|
498 | 500 | uniqueKey: {
|
499 |
| - type: String |
| 501 | + type: [String, Number] |
500 | 502 | },
|
501 | 503 | extraProps: {
|
502 | 504 | type: Object
|
| 505 | + }, |
| 506 | + scopedSlots: { |
| 507 | + type: Object |
503 | 508 | }
|
504 | 509 | };
|
505 | 510 | var SlotProps = {
|
|
564 | 569 | component = this.component,
|
565 | 570 | _this$extraProps = this.extraProps,
|
566 | 571 | extraProps = _this$extraProps === void 0 ? {} : _this$extraProps,
|
567 |
| - index = this.index; |
| 572 | + index = this.index, |
| 573 | + _this$scopedSlots = this.scopedSlots, |
| 574 | + scopedSlots = _this$scopedSlots === void 0 ? {} : _this$scopedSlots; |
568 | 575 | extraProps.source = this.source;
|
569 | 576 | extraProps.index = index;
|
570 | 577 | return h(tag, {
|
571 | 578 | attrs: {
|
572 | 579 | role: 'item'
|
573 | 580 | }
|
574 | 581 | }, [h(component, {
|
575 |
| - props: extraProps |
| 582 | + props: extraProps, |
| 583 | + scopedSlots: scopedSlots |
576 | 584 | })]);
|
577 | 585 | }
|
578 | 586 | }); // wrapping for slot
|
|
838 | 846 | itemStyle = this.itemStyle,
|
839 | 847 | isHorizontal = this.isHorizontal,
|
840 | 848 | extraProps = this.extraProps,
|
841 |
| - dataComponent = this.dataComponent; |
| 849 | + dataComponent = this.dataComponent, |
| 850 | + itemScopedSlots = this.itemScopedSlots; |
842 | 851 |
|
843 | 852 | for (var index = start; index <= end; index++) {
|
844 | 853 | var dataSource = dataSources[index];
|
845 | 854 |
|
846 | 855 | if (dataSource) {
|
847 | 856 | if (Object.prototype.hasOwnProperty.call(dataSource, dataKey)) {
|
848 | 857 | slots.push(h(Item, {
|
| 858 | + key: dataSource[dataKey], |
849 | 859 | props: {
|
850 | 860 | index: index,
|
851 | 861 | tag: itemTag,
|
|
854 | 864 | uniqueKey: dataSource[dataKey],
|
855 | 865 | source: dataSource,
|
856 | 866 | extraProps: extraProps,
|
857 |
| - component: dataComponent |
| 867 | + component: dataComponent, |
| 868 | + scopedSlots: itemScopedSlots |
858 | 869 | },
|
859 | 870 | style: itemStyle,
|
860 | 871 | "class": "".concat(itemClass).concat(this.itemClassAdd ? ' ' + this.itemClassAdd(index) : '')
|
|
0 commit comments