File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " vue-windowing" ,
3- "version" : " 0.14.3 " ,
3+ "version" : " 0.14.4 " ,
44 "description" : " Set of components used for virtualizing DOM" ,
55 "author" : {
66 "name" : " Maciej Kaczorowski" ,
Original file line number Diff line number Diff line change @@ -13,13 +13,11 @@ export default {
1313 },
1414 },
1515 updated () {
16- if (this .$el ) {
17- this .onHeightChange (this .$el .offsetHeight );
18- }
16+ this .onHeightChange (this .$el .offsetHeight );
1917 },
2018 methods: {
2119 onHeightChange (height ) {
22- if (height !== this .height && height !== 0 ) {
20+ if (this . $el && height !== this .height && height !== 0 ) {
2321 this .$emit (' height' , {
2422 index: this .index ,
2523 height,
Original file line number Diff line number Diff line change 1515 class =" virtual-scroll__spacer" >
1616 <AutoHeightMeasurer
1717 v-for =" (item, index) in visibleItems"
18- :key =" `${index + startNode} | ${ item.id || item}`"
18+ :key =" `${item.id || item}`"
1919 :index =" index + startNode"
2020 :height =" cachedHeight[index + startNode] || estimatedHeight"
2121 @height =" onMeasuredHeight" >
@@ -75,16 +75,11 @@ export default {
7575 watch: {
7676 items (newValue , oldValue ) {
7777 if (newValue .length !== oldValue .length ) {
78- const startNode = this .getFirstVisibleNode ();
79- const endNode = this .getLastVisibleNode (startNode);
80-
81- this .firstVisibleNode = startNode;
82- this .lastVisibleNode = endNode;
83-
8478 this .totalHeight = this .items .length * this .estimatedHeight ;
8579 this .childPositions = {
8680 0 : 0 ,
8781 };
82+
8883 this .cachedHeight = {};
8984 }
9085 },
@@ -155,6 +150,14 @@ export default {
155150 },
156151 onResize (entry ) {
157152 this .height = entry .contentRect .height ;
153+
154+ if (this .height > 0 && this .rowCount > 0 ) {
155+ const startNode = this .getFirstVisibleNode ();
156+ const endNode = this .getLastVisibleNode (startNode);
157+
158+ this .firstVisibleNode = startNode;
159+ this .lastVisibleNode = endNode;
160+ }
158161 },
159162 onMeasuredHeight ({
160163 index,
You can’t perform that action at this time.
0 commit comments