Skip to content

Commit 1c8b651

Browse files
committed
v2.6.0
1 parent fcea001 commit 1c8b651

7 files changed

Lines changed: 1136 additions & 581 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"repo": "vixcpp/vix",
3-
"fetched_at": "2026-05-14T10:44:04.762Z",
4-
"stars": 426,
3+
"fetched_at": "2026-05-26T23:23:18.042Z",
4+
"stars": 441,
55
"forks": 32,
6-
"open_issues": 15,
6+
"open_issues": 1,
77
"watchers": 4,
8-
"rate_limit": "auth"
8+
"rate_limit": "public"
99
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<script setup>
2+
import { ref, onMounted, onBeforeUnmount } from "vue";
3+
4+
const props = defineProps({
5+
rootMargin: {
6+
type: String,
7+
default: "260px",
8+
},
9+
});
10+
11+
const el = ref(null);
12+
const visible = ref(false);
13+
14+
let observer = null;
15+
16+
onMounted(() => {
17+
if (!el.value) return;
18+
19+
if (!("IntersectionObserver" in window)) {
20+
visible.value = true;
21+
return;
22+
}
23+
24+
observer = new IntersectionObserver(
25+
([entry]) => {
26+
if (!entry?.isIntersecting) return;
27+
28+
visible.value = true;
29+
30+
if (observer) {
31+
observer.disconnect();
32+
observer = null;
33+
}
34+
},
35+
{
36+
root: null,
37+
rootMargin: props.rootMargin,
38+
threshold: 0.01,
39+
},
40+
);
41+
42+
observer.observe(el.value);
43+
});
44+
45+
onBeforeUnmount(() => {
46+
if (observer) {
47+
observer.disconnect();
48+
observer = null;
49+
}
50+
});
51+
</script>
52+
53+
<template>
54+
<div ref="el" class="lazy-section">
55+
<slot v-if="visible" />
56+
</div>
57+
</template>
58+
59+
<style scoped>
60+
.lazy-section {
61+
min-height: 1px;
62+
}
63+
</style>
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"repo": "vixcpp/vix",
3-
"fetched_at": "2026-05-14T10:44:04.762Z",
4-
"stars": 426,
3+
"fetched_at": "2026-05-26T23:23:18.042Z",
4+
"stars": 441,
55
"forks": 32,
6-
"open_issues": 15,
6+
"open_issues": 1,
77
"watchers": 4,
8-
"rate_limit": "auth"
8+
"rate_limit": "public"
99
}

0 commit comments

Comments
 (0)