File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 11/*!
2- * vue-virtual-scroll-list v2.2.6
2+ * vue-virtual-scroll-list v2.2.7
33 * open source under the MIT license
44 * https://github.com/tangbc/vue-virtual-scroll-list#readme
55 */
376376 */
377377 var VirtualProps = {
378378 dataKey : {
379- type : String ,
379+ type : [ String , Function ] ,
380380 required : true
381381 } ,
382382 dataSources : {
785785 this . range = this . virtual . getRange ( ) ;
786786 } ,
787787 getUniqueIdFromDataSources : function getUniqueIdFromDataSources ( ) {
788- var _this2 = this ;
789-
788+ var dataKey = this . dataKey ;
790789 return this . dataSources . map ( function ( dataSource ) {
791- return dataSource [ _this2 . dataKey ] ;
790+ return typeof dataKey === 'function' ? dataKey ( dataSource ) : dataSource [ dataKey ] ;
792791 } ) ;
793792 } ,
794793 // event called when each item mounted or size changed
856855 var dataSource = dataSources [ index ] ;
857856
858857 if ( dataSource ) {
859- if ( Object . prototype . hasOwnProperty . call ( dataSource , dataKey ) ) {
858+ var uniqueKey = typeof dataKey === 'function' ? dataKey ( dataSource ) : dataSource [ dataKey ] ;
859+
860+ if ( typeof uniqueKey === 'string' || typeof uniqueKey === 'number' ) {
860861 slots . push ( h ( Item , {
861- // key: dataSource[dataKey],
862862 props : {
863863 index : index ,
864864 tag : itemTag ,
865865 event : EVENT_TYPE . ITEM ,
866866 horizontal : isHorizontal ,
867- uniqueKey : dataSource [ dataKey ] ,
867+ uniqueKey : uniqueKey ,
868868 source : dataSource ,
869869 extraProps : extraProps ,
870870 component : dataComponent ,
Original file line number Diff line number Diff line change 11{
22 "name" : " vue-virtual-scroll-list" ,
3- "version" : " 2.2.6 " ,
3+ "version" : " 2.2.7 " ,
44 "description" : " A vue component support big amount data list with high scroll performance." ,
55 "main" : " dist/index.js" ,
66 "files" : [
You can’t perform that action at this time.
0 commit comments