Skip to content

Commit d7bb1cb

Browse files
author
Guillaume Chau
committed
fix: simplify argument
1 parent 39607a9 commit d7bb1cb

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

src/components/RecycleList.vue

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,16 @@ export default {
6464
},
6565
6666
watch: {
67-
items: {
68-
handler () {
69-
this.updateVisibleItems({
70-
checkItem: true,
71-
})
67+
items () {
68+
this.updateVisibleItems(true)
7269
},
73-
},
7470
pageMode () {
7571
this.applyPageMode()
76-
this.updateVisibleItems({
77-
checkItem: false,
78-
})
72+
this.updateVisibleItems(false)
7973
},
8074
heights: {
8175
handler () {
82-
this.updateVisibleItems({
83-
checkItem: false,
84-
})
76+
this.updateVisibleItems(false)
8577
},
8678
deep: true,
8779
},
@@ -101,9 +93,7 @@ export default {
10193
mounted () {
10294
this.applyPageMode()
10395
this.$nextTick(() => {
104-
this.updateVisibleItems({
105-
checkItem: true,
106-
})
96+
this.updateVisibleItems(true)
10797
this.$_ready = true
10898
})
10999
},
@@ -147,19 +137,15 @@ export default {
147137
148138
handleResize () {
149139
this.$emit('resize')
150-
this.$_ready && this.updateVisibleItems({
151-
checkItem: false,
152-
})
140+
if (this.$_ready) this.updateVisibleItems(false)
153141
},
154142
155143
handleScroll (event) {
156144
if (!this.$_scrollDirty) {
157145
this.$_scrollDirty = true
158146
requestAnimationFrame(() => {
159147
this.$_scrollDirty = false
160-
const { continuous } = this.updateVisibleItems({
161-
checkItem: false,
162-
})
148+
const { continuous } = this.updateVisibleItems(false)
163149
164150
// It seems sometimes chrome doesn't fire scroll event :/
165151
// When non continous scrolling is ending, we force a refresh
@@ -175,14 +161,12 @@ export default {
175161
if (this.$_ready && (isVisible || entry.boundingClientRect.width !== 0 || entry.boundingClientRect.height !== 0)) {
176162
this.$emit('visible')
177163
requestAnimationFrame(() => {
178-
this.updateVisibleItems({
179-
checkItem: false,
164+
this.updateVisibleItems(false)
180165
})
181-
})
182166
}
183167
},
184168
185-
updateVisibleItems ({ checkItem }) {
169+
updateVisibleItems (checkItem) {
186170
const scroll = this.getScroll()
187171
const buffer = parseInt(this.buffer)
188172
scroll.top -= buffer

0 commit comments

Comments
 (0)