Skip to content

Commit 7735a19

Browse files
committed
Add rtagClass and wtagClass support
1 parent 6b6bf3a commit 7735a19

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ new Vue({
110110
| remain | Number || How many items except show in virtual-list viewport, so `size` and `remian` will determine the virtual-list outside container height (size × remian). |
111111
| start | Number | * | Default value is `0`, the initial scroll start index. It must be integer and in the range of list index, do nothing but throw a warnning if not match. |
112112
| rtag | String | * | Default value is `div`, the virtual-list's root HTMLElement tag name, in all case it's style is set to `display: block;` |
113+
| rtagClass | String | * | Default value is an empty string, the virtual-list's root HTMLElement tag's classes. Has the same API has [`v-bind:class`](https://vuejs.org/v2/guide/class-and-style.html) |
113114
| wtag | String | * | Default value is `div`, the virtual-list's item wrapper HTMLElement tag name, in all case it's style is set to `display: block;` |
115+
| wtagClass | String | * | Default value is an empty string, the virtual-list's item wrapper HTMLElement tag's classes. Has the same API has [`v-bind:class`](https://vuejs.org/v2/guide/class-and-style.html) |
114116
| onscroll | Function | * | Called when virtual-list scroll event hanlding, param: `(e, scrollTop)`. |
115117
| totop | Function | * | Called when the virtual-list is scrolled to top. |
116118
| tobottom | Function | * | Called when the virtual-list is scrolled to bottom. |

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
size: { type: Number, required: true },
2121
remain: { type: Number, required: true },
2222
rtag: { type: String, default: 'div' },
23+
rtagClass: { type: String, default: '' },
2324
wtag: { type: String, default: 'div' },
25+
wtagClass: { type: String, default: '' },
2426
start: { type: Number, default: 0 },
2527
totop: Function,
2628
tobottom: Function,
@@ -213,14 +215,16 @@
213215
},
214216
'on': {
215217
'scroll': this.handleScroll
216-
}
218+
},
219+
'class': this.rtagClass
217220
}, [
218221
createElement(this.wtag, {
219222
'style': {
220223
'display': 'block',
221224
'padding-top': delta.paddingTop + 'px',
222225
'padding-bottom': delta.allPadding - delta.paddingTop + 'px'
223-
}
226+
},
227+
'class': this.wtagClass
224228
}, showList)
225229
])
226230
}

0 commit comments

Comments
 (0)