@@ -221,7 +221,7 @@ const VirtualList = Vue.component('virtual-list', {
221
221
getRenderSlots ( h ) {
222
222
const slots = [ ]
223
223
const { start, end } = this . range
224
- const { dataSources, dataKey, itemClass, itemTag, isHorizontal, extraProps, dataComponent } = this
224
+ const { dataSources, dataKey, itemClass, itemTag, itemStyle , isHorizontal, extraProps, dataComponent } = this
225
225
for ( let index = start ; index <= end ; index ++ ) {
226
226
const dataSource = dataSources [ index ]
227
227
if ( dataSource ) {
@@ -237,6 +237,7 @@ const VirtualList = Vue.component('virtual-list', {
237
237
extraProps : extraProps ,
238
238
component : dataComponent
239
239
} ,
240
+ style : itemStyle ,
240
241
class : `${ itemClass } ${ this . itemClassAdd ? ' ' + this . itemClassAdd ( index ) : '' } `
241
242
} ) )
242
243
} else {
@@ -255,8 +256,9 @@ const VirtualList = Vue.component('virtual-list', {
255
256
render ( h ) {
256
257
const { header, footer } = this . $slots
257
258
const { padFront, padBehind } = this . range
258
- const { rootTag, headerClass, headerTag, wrapTag, wrapClass, footerClass, footerTag, isHorizontal } = this
259
- const padding = isHorizontal ? `0px ${ padBehind } px 0px ${ padFront } px` : `${ padFront } px 0px ${ padBehind } px`
259
+ const { isHorizontal, rootTag, wrapTag, wrapClass, wrapStyle, headerTag, headerClass, headerStyle, footerTag, footerClass, footerStyle } = this
260
+ const paddingStyle = { padding : isHorizontal ? `0px ${ padBehind } px 0px ${ padFront } px` : `${ padFront } px 0px ${ padBehind } px` }
261
+ const wrapperStyle = wrapStyle ? Object . assign ( wrapStyle , paddingStyle ) : paddingStyle
260
262
261
263
return h ( rootTag , {
262
264
ref : 'root' ,
@@ -267,6 +269,7 @@ const VirtualList = Vue.component('virtual-list', {
267
269
// header slot
268
270
header ? h ( Slot , {
269
271
class : headerClass ,
272
+ style : headerStyle ,
270
273
props : {
271
274
tag : headerTag ,
272
275
event : EVENT_TYPE . SLOT ,
@@ -280,14 +283,13 @@ const VirtualList = Vue.component('virtual-list', {
280
283
attrs : {
281
284
role : 'group'
282
285
} ,
283
- style : {
284
- padding : padding
285
- }
286
+ style : wrapperStyle
286
287
} , this . getRenderSlots ( h ) ) ,
287
288
288
289
// footer slot
289
290
footer ? h ( Slot , {
290
291
class : footerClass ,
292
+ style : footerStyle ,
291
293
props : {
292
294
tag : footerTag ,
293
295
event : EVENT_TYPE . SLOT ,
0 commit comments