Skip to content

Commit 13804a5

Browse files
committed
1.0.5
1 parent 7e8d540 commit 13804a5

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ of the body also needs to be specified. The scrolling event can be bound to the
6363
| virtual | boolean | true | Enable virtual list |
6464
| rowKey | string | 'id' | Key for v-for |
6565
| gap | number | 15 | Gap between each item |
66-
| padding | number or string | 15 or '15px 20px' | Container's padding |
66+
| padding | number or string | 15 or '15px 15px' | Container's padding |
6767
| preloadScreenCount | `[number, number]` | `[0, 0]` | Preload screen count `[above, below]` |
6868
| itemMinWidth | number | 220 | Minimum width for each item |
6969
| maxColumnCount | number | 10 | Maximum number of columns |

README.zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ app.use(VueVirtualWaterfall)
6363
| virtual | boolean | true | 是否启用虚拟列表 |
6464
| rowKey | string | 'id' | v-for需要用到key |
6565
| gap | number | 15 | 每个item之间的间隔 |
66-
| padding | number or string | 15 or '15px 20px' | 容器内边距 |
66+
| padding | number or string | 15 or '15px 15px' | 容器内边距 |
6767
| preloadScreenCount | `[number, number]` | `[0:0]` | 预加载屏数量`[上面预加载屏数,下面预加载屏数]` |
6868
| itemMinWidth | number | 220 | 每个item最小宽度 |
6969
| maxColumnCount | number | 10 | 允许的最大列数 |

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@lhlyu/vue-virtual-waterfall",
33
"description": "vue3 virtual waterfall component",
4-
"version": "1.0.4",
4+
"version": "1.0.5",
55
"author": "lhlyu",
66
"repository": {
77
"type": "git",
@@ -39,15 +39,15 @@
3939
"devDependencies": {
4040
"@vitejs/plugin-vue": "^5.0.4",
4141
"autoprefixer": "^10.4.19",
42-
"cssnano": "^6.1.1",
42+
"cssnano": "^6.1.2",
4343
"postcss": "^8.4.38",
4444
"prettier": "^3.2.5",
4545
"prettier-plugin-rational-order": "^1.0.3",
46-
"sass": "^1.72.0",
47-
"typescript": "^5.4.3",
48-
"vite": "^5.2.4",
49-
"vite-plugin-dts": "^3.7.3",
46+
"sass": "^1.74.1",
47+
"typescript": "^5.4.5",
48+
"vite": "^5.2.8",
49+
"vite-plugin-dts": "^3.8.1",
5050
"vue": "^3.4.21",
51-
"vue-tsc": "^2.0.7"
51+
"vue-tsc": "^2.0.12"
5252
}
5353
}

src/vue-virtual-waterfall/virtual-waterfall.vue

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,7 @@ const itemRenderList = computed<SpaceOption[]>(() => {
208208
// 底部的范围: 向下预加载preloadScreenCount个屏幕
209209
const maxLimit = tp + (bottomPreloadScreenCount + 1) * innerHeight
210210
211-
let start = 0
212-
let end = 0
213-
let open = true
211+
const items = []
214212
215213
for (let i = 0; i < length; i++) {
216214
const v = itemSpaces.value[i]
@@ -226,15 +224,10 @@ const itemRenderList = computed<SpaceOption[]>(() => {
226224
(b >= minLimit && b <= maxLimit) ||
227225
(t < minLimit && b > maxLimit)
228226
) {
229-
if (open) {
230-
start = i
231-
open = false
232-
}
233-
end = i
227+
items.push(v)
234228
}
235229
}
236-
// 测试发现slice方法很快
237-
return itemSpaces.value.slice(start, end + 1)
230+
return items
238231
})
239232
240233
// 获取当前元素应该处于哪一列

0 commit comments

Comments
 (0)