18n/dist/assets/useInView_1731572575.js
2024-11-14 16:23:10 +08:00

2 lines
365 B
JavaScript

function e(){const e={rootMargin:"0px",threshold:.5,once:!0},t=(e,t)=>{e.forEach((e=>{if(e.intersectionRatio<=0)return;const r=e.target,o=r.getAttribute("data-src");r.setAttribute("src",o??""),r.onload=()=>{},t.unobserve(r)}))};return{processImage:r=>{const o=new IntersectionObserver(t,e);Object.keys(r.value).forEach((e=>o.observe(r.value[e])))}}}export{e as u};