File tree Expand file tree Collapse file tree 2 files changed +35
-8
lines changed
packages/vue-virtual-scroller/src/components Expand file tree Collapse file tree 2 files changed +35
-8
lines changed Original file line number Diff line number Diff line change 1+ <!-- Avoir re-renders of slots -->
2+
3+ <template >
4+ <component
5+ :is =" itemTag"
6+ class =" vue-recycle-scroller__item-view"
7+ >
8+ <slot
9+ :item =" view.item"
10+ :index =" view.nr.index"
11+ :active =" view.nr.used"
12+ />
13+ </component >
14+ </template >
15+
16+ <script >
17+ export default {
18+ props: {
19+ view: Object ,
20+ itemTag: String ,
21+ },
22+ }
23+ </script >
Original file line number Diff line number Diff line change 2626 class =" vue-recycle-scroller__item-wrapper"
2727 :class =" listClass"
2828 >
29- <component
30- :is =" itemTag"
29+ <ItemView
3130 v-for =" view of pool"
3231 ref =" items"
3332 :key =" view.nr.id"
33+ :view =" view"
34+ :item-tag =" itemTag"
3435 :style =" ready
3536 ? [
3637 (disableTransform
5455 mouseleave: () => { hoverKey = null },
5556 }"
5657 >
57- <slot
58- :item =" view.item"
59- :index =" view.nr.index"
60- :active =" view.nr.used"
61- />
62- </component >
58+ <template #default =" props " >
59+ <slot v-bind =" props" />
60+ </template >
61+ </ItemView >
6362
6463 <slot
6564 name =" empty"
@@ -88,13 +87,15 @@ import { getScrollParent } from '../scrollparent'
8887import config from ' ../config'
8988import { props , simpleArray } from ' ./common'
9089import { supportsPassive } from ' ../utils'
90+ import ItemView from ' ./ItemView.vue'
9191
9292let uid = 0
9393
9494export default {
9595 name: ' RecycleScroller' ,
9696
9797 components: {
98+ ItemView,
9899 ResizeObserver,
99100 },
100101
@@ -205,6 +206,9 @@ export default {
205206 pool: [],
206207 totalSize: 0 ,
207208 ready: false ,
209+ /**
210+ * We need the key of the hovered item to prevent ItemView that gets recycled to keep the hover state.
211+ */
208212 hoverKey: null ,
209213 }
210214 },
You can’t perform that action at this time.
0 commit comments