Skip to content

Commit 545a171

Browse files
committed
Build.
1 parent bcdbee1 commit 545a171

File tree

8 files changed

+38
-11
lines changed

8 files changed

+38
-11
lines changed

demos/item-mode/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/page-mode/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/scroll-element/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/table-mode/build.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/table-mode/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en-US">
33
<head>
44
<meta charset="utf-8">
5-
<title>demos\table-mode demo of vue-virtual-scroll-list</title>
5+
<title>table-mode demo of vue-virtual-scroll-list</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1,user-scalable=0"/>
77
</head>
88
<body>

demos/variable-height/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demos/vfor-mode/build.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
111111
// Boolean just disable for priviate.
112112
"default": false
113113
},
114+
isTable: {
115+
type: Boolean,
116+
"default": false
117+
},
114118
item: {
115-
type: Object,
119+
type: [Function, Object],
116120
"default": null
117121
},
118122
itemcount: {
@@ -488,7 +492,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
488492
var delta = this.delta;
489493
var slots = this.$slots["default"] || []; // item-mode shoud judge from items prop.
490494

491-
if (this.item) {
495+
if (this.item || this.$scopedSlots.item) {
492496
delta.total = this.itemcount;
493497

494498
if (delta.keeps > delta.total) {
@@ -527,7 +531,9 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
527531
for (var i = delta.start; i < delta.total && i <= Math.ceil(delta.end); i++) {
528532
var slot = null;
529533

530-
if (this.item) {
534+
if (this.$scopedSlots.item) {
535+
slot = this.$scopedSlots.item(i);
536+
} else if (this.item) {
531537
slot = h(this.item, this.itemprops(i));
532538
} else {
533539
slot = slots[i];
@@ -545,7 +551,15 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
545551
var _this$delta = this.delta,
546552
paddingTop = _this$delta.paddingTop,
547553
paddingBottom = _this$delta.paddingBottom;
548-
var renderList = h(this.wtag, {
554+
var isTable = this.isTable;
555+
var wtag = isTable ? 'div' : this.wtag;
556+
var rtag = isTable ? 'div' : this.rtag;
557+
558+
if (isTable) {
559+
list = [h('table', [h('tbody', list)])];
560+
}
561+
562+
var renderList = h(wtag, {
549563
style: {
550564
display: 'block',
551565
'padding-top': paddingTop + 'px',
@@ -561,7 +575,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
561575
return renderList;
562576
}
563577

564-
return h(this.rtag, {
578+
return h(rtag, {
565579
ref: 'vsl',
566580
style: {
567581
display: 'block',

0 commit comments

Comments
 (0)