File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -211,20 +211,24 @@ const VirtualList = Vue.component('virtual-list', {
211211 for ( let index = start ; index <= end ; index ++ ) {
212212 const dataSource = this . dataSources [ index ]
213213 if ( dataSource ) {
214- slots . push ( h ( Item , {
215- class : this . itemClass ,
216- props : {
217- tag : this . itemTag ,
218- event : EVENT_TYPE . ITEM ,
219- horizontal : this . isHorizontal ,
220- uniqueKey : dataSource [ this . dataKey ] ,
221- source : dataSource ,
222- extraProps : this . extraProps ,
223- component : this . dataComponent
224- }
225- } ) )
214+ if ( dataSource [ this . dataKey ] ) {
215+ slots . push ( h ( Item , {
216+ class : this . itemClass ,
217+ props : {
218+ tag : this . itemTag ,
219+ event : EVENT_TYPE . ITEM ,
220+ horizontal : this . isHorizontal ,
221+ uniqueKey : dataSource [ this . dataKey ] ,
222+ source : dataSource ,
223+ extraProps : this . extraProps ,
224+ component : this . dataComponent
225+ }
226+ } ) )
227+ } else {
228+ console . warn ( `Cannot get the data-key '${ this . dataKey } ' from data-sources.` )
229+ }
226230 } else {
227- console . warn ( `Cannot get the index ${ index } from data-sources.` )
231+ console . warn ( `Cannot get the index ' ${ index } ' from data-sources.` )
228232 }
229233 }
230234 return slots
You can’t perform that action at this time.
0 commit comments