{"id":13418859,"url":"https://github.com/jambonn/vue-lazyload","last_synced_at":"2026-01-22T20:35:17.855Z","repository":{"id":57120100,"uuid":"357525364","full_name":"jambonn/vue-lazyload","owner":"jambonn","description":"Vue module for lazy-loading images in your vue 3 applications.","archived":false,"fork":false,"pushed_at":"2024-03-27T02:25:24.000Z","size":83,"stargazers_count":39,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-03T13:57:34.400Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jambonn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-13T11:17:57.000Z","updated_at":"2025-08-06T11:30:50.000Z","dependencies_parsed_at":"2024-04-27T05:32:14.875Z","dependency_job_id":"3ef2c31e-198b-4130-b5b2-6cb1dbd93153","html_url":"https://github.com/jambonn/vue-lazyload","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/jambonn/vue-lazyload","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jambonn%2Fvue-lazyload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jambonn%2Fvue-lazyload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jambonn%2Fvue-lazyload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jambonn%2Fvue-lazyload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jambonn","download_url":"https://codeload.github.com/jambonn/vue-lazyload/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jambonn%2Fvue-lazyload/sbom","scorecard":{"id":503334,"data":{"date":"2025-08-11","repo":{"name":"github.com/jambonn/vue-lazyload","commit":"9898759cd12b2edc272aa425f2e1faab11662325"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 2/14 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"28 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-mv48-hcvh-8jj8","Warn: Project is vulnerable to: GHSA-353f-5xf4-qw67","Warn: Project is vulnerable to: GHSA-64vr-g452-qvp3","Warn: Project is vulnerable to: GHSA-9cwx-2883-4wfx","Warn: Project is vulnerable to: GHSA-vg6x-rcgg-rjx6","Warn: Project is vulnerable to: GHSA-x574-m823-4x7w","Warn: Project is vulnerable to: GHSA-4r4m-qw57-chr8","Warn: Project is vulnerable to: GHSA-xcj6-pq6g-qj4x","Warn: Project is vulnerable to: GHSA-356w-63v5-8wf4","Warn: Project is vulnerable to: GHSA-859w-5945-r5v3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T22:36:01.167Z","repository_id":57120100,"created_at":"2025-08-19T22:36:01.168Z","updated_at":"2025-08-19T22:36:01.168Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28670385,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T19:36:09.361Z","status":"ssl_error","status_checked_at":"2026-01-22T19:36:05.567Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T22:01:08.017Z","updated_at":"2026-01-22T20:35:17.833Z","avatar_url":"https://github.com/jambonn.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","UI Utilities [🔝](#readme)","Components \u0026 Libraries"],"sub_categories":["UI Utilities"],"readme":"# Vue-Lazyload\nVue module for lazyloading images in your Vue 3 applications. This module is base on vue-lazyload. Vue 1.x or 2.x please use [vue-lazyload](https://github.com/hilongjw/vue-lazyload). Some of goals of this project worth noting include:\n\n* Be lightweight, powerful and easy to use\n* Work on any image type\n* Add loading class while image is loading\n* Supports Vue 3\n\n# Table of Contents\n\n* [___Requirements___](#requirements)\n* [___Installation___](#installation)\n* [___Usage___](#usage)\n* [___Constructor Options___](#constructor-options)\n* [___Implementation___](#implementation)\n    * [___Basic___](#basic)\n    * [___Css state___](#css-state)\n* [___Methods___](#methods)\n    * [__Event hook__](#event-hook)\n    * [__LazyLoadHandler__](#lazyloadhandler)\n    * [__Performance__](#performance)\n* [___Authors \u0026\u0026 Contributors___](#authors-\u0026\u0026-Contributors)\n* [___License___](#license)\n\n# Requirements\n\n- [Vue.js](https://github.com/vuejs/vue-next) `3.x`\n\n# Installation\n\n## npm\n\n```bash\n\n$ npm i @jambonn/vue-lazyload\n\n```\n\n## yarn\n\n```bash\n\n$ yarn add @jambonn/vue-lazyload\n\n```\n\n## CDN\n\nCDN: [https://unpkg.com/@jambonn/vue-lazyload/dist/vue-lazyload.umd.js](https://unpkg.com/@jambonn/vue-lazyload/dist/vue-lazyload.umd.js)\n\n```html\n\u003cscript src=\"https://unpkg.com/@jambonn/vue-lazyload/dist/vue-lazyload.umd.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var AttributeBindingApp = {\n    data() {\n      return {\n        message: 'Vue Lazyload'\n      }\n    }\n  }\n  var app = Vue.createApp(AttributeBindingApp)\n  app.use(window['vue-lazyload'].default)\n  app.mount('#bind-attribute')\n  ...\n\u003c/script\u003e\n\n```\n\n# Usage\n\nmain.js:\n\n```javascript\n\nimport { createApp } from 'vue'\nimport VueLazyload from '@jambonn/vue-lazyload'\nimport App from './App.vue'\n\nconst app = createApp(App)\napp.use(VueLazyload)\n\n// or with options\nconst loadimage = require('./assets/loading.gif')\nconst errorimage = require('./assets/error.gif')\napp.use(VueLazyload, {\n  preLoad: 1.3,\n  error: errorimage,\n  loading: loadimage,\n  attempt: 1\n})\n\napp.mount('#app')\n```\n\ntemplate:\n\n```html\n\u003cul\u003e\n  \u003cli v-for=\"img in list\"\u003e\n    \u003cimg v-lazy=\"img.src\" \u003e\n  \u003c/li\u003e\n\u003c/ul\u003e\n```\n\nuse `v-lazy-container` work with raw HTML\n\n```html\n\u003cdiv v-lazy-container=\"{ selector: 'img' }\"\u003e\n  \u003cimg data-src=\"//domain.com/img1.jpg\"\u003e\n  \u003cimg data-src=\"//domain.com/img2.jpg\"\u003e\n  \u003cimg data-src=\"//domain.com/img3.jpg\"\u003e  \n\u003c/div\u003e\n```\n\ncustom `error` and `loading` placeholder image\n\n```html\n\u003cdiv v-lazy-container=\"{ selector: 'img', error: 'xxx.jpg', loading: 'xxx.jpg' }\"\u003e\n  \u003cimg data-src=\"//domain.com/img1.jpg\"\u003e\n  \u003cimg data-src=\"//domain.com/img2.jpg\"\u003e\n  \u003cimg data-src=\"//domain.com/img3.jpg\"\u003e  \n\u003c/div\u003e\n```\n\n```html\n\u003cdiv v-lazy-container=\"{ selector: 'img' }\"\u003e\n  \u003cimg data-src=\"//domain.com/img1.jpg\" data-error=\"xxx.jpg\"\u003e\n  \u003cimg data-src=\"//domain.com/img2.jpg\" data-loading=\"xxx.jpg\"\u003e\n  \u003cimg data-src=\"//domain.com/img3.jpg\"\u003e  \n\u003c/div\u003e\n```\n\n## Constructor Options\n\n|key|description|default|options|\n|:---|---|---|---|\n| `preLoad`|proportion of pre-loading height|`1.3`|`Number`|\n|`error`|src of the image upon load fail|`'data-src'`|`String`\n|`loading`|src of the image while loading|`'data-src'`|`String`|\n|`attempt`|attempts count|`3`|`Number`|\n|`listenEvents`|events that you want vue listen for|`['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove']`| [Desired Listen Events](#desired-listen-events) |\n|`adapter`| dynamically modify the attribute of element |`{ }`| [Element Adapter](#element-adapter) |\n|`filter`| the image's listener filter |`{ }`| [Image listener filter](#image-listener-filter) |\n|`lazyComponent`| lazyload component | `false` | [Lazy Component](#lazy-component)\n| `dispatchEvent`|trigger the dom event|`false`|`Boolean`|\n| `throttleWait`|throttle wait|`200`|`Number`|\n| `observer`|use IntersectionObserver|`false`|`Boolean`|\n| `observerOptions`|IntersectionObserver options|{ rootMargin: '0px', threshold: 0.1 }|[IntersectionObserver](#intersectionobserver)|\n| `silent`|do not print debug info|`true`|`Boolean`|\n\n### Desired Listen Events\n\nYou can configure which events you want vue-lazyload by passing in an array\nof listener names.\n\n```javascript\nconst app = createApp(AttributeBindingApp)\napp.use(VueLazyload, {\n  preLoad: 1.3,\n  error: 'dist/error.png',\n  loading: 'dist/loading.gif',\n  attempt: 1,\n  // the default is ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend']\n  listenEvents: [ 'scroll' ]\n})\n```\n\nThis is useful if you are having trouble with this plugin resetting itself to loading\nwhen you have certain animations and transitions taking place\n\n### Image listener filter\n\ndynamically modify the src of image\n\n```javascript\nconst app = createApp(AttributeBindingApp)\napp.use(VueLazyload, {\n    filter: {\n      progressive (listener, options) {\n          const isCDN = /qiniudn.com/\n          if (isCDN.test(listener.src)) {\n              listener.el.setAttribute('lazy-progressive', 'true')\n              listener.loading = listener.src + '?imageView2/1/w/10/h/10'\n          }\n      },\n      webp (listener, options) {\n          if (!options.supportWebp) return\n          const isCDN = /qiniudn.com/\n          if (isCDN.test(listener.src)) {\n              listener.src += '?imageView2/2/format/webp'\n          }\n      }\n    }\n})\n```\n\n### Element Adapter\n\n```javascript\nconst app = createApp(AttributeBindingApp)\napp.use(VueLazyload, {\n    adapter: {\n        loaded ({ bindType, el, naturalHeight, naturalWidth, $parent, src, loading, error, Init }) {\n            // do something here\n            // example for call LoadedHandler\n            LoadedHandler(el)\n        },\n        loading (listender, Init) {\n            console.log('loading')\n        },\n        error (listender, Init) {\n            console.log('error')\n        }\n    }\n})\n```\n\n### IntersectionObserver\n\nuse [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) to to improve performance of a large number of nodes.\n\n```javascript\nconst app = createApp(AttributeBindingApp)\napp.use(vueLazy, {\n  // set observer to true\n  observer: true,\n\n  // optional\n  observerOptions: {\n    rootMargin: '0px',\n    threshold: 0.1\n  }\n})\n```\n\n### Lazy Component\n```javascript\nconst app = createApp(AttributeBindingApp)\napp.use(VueLazyload, {\n  lazyComponent: true\n});\n```\n\n```html\n\u003clazy-component @show=\"handler\"\u003e\n  \u003cimg class=\"mini-cover\" :src=\"img.src\" width=\"100%\" height=\"400\"\u003e\n\u003c/lazy-component\u003e\n\n\u003cscript\u003e\n  export default {\n    setup () {\n      const handler = () =\u003e {\n        console.log('this component is showing')\n      }\n      return { handler }\n    }\n  }\n\u003c/script\u003e\n```\nUse in list\n```html\n\u003clazy-component v-for=\"(item, index) in list\" :key=\"item.src\" \u003e\n  \u003cimg class=\"mini-cover\" :src=\"item.src\" width=\"100%\" height=\"400\"\u003e\n\u003c/lazy-component\u003e\n```\n\n\n## Implementation\n\n### Basic\n\nvue-lazyload will set this img element's `src` with `imgUrl` string\n\n```html\n\u003ctemplate\u003e\n  \u003cdiv\"\u003e\n     \u003cimg v-lazy=\"imgUrl\"/\u003e\n     \u003cdiv v-lazy:background-image=\"imgUrl\"\u003e\u003c/div\u003e\n\n     \u003c!-- with customer error and loading --\u003e\n     \u003cimg v-lazy=\"imgObj\"/\u003e\n     \u003cdiv v-lazy:background-image=\"imgObj\"\u003e\u003c/div\u003e\n\n     \u003c!-- Customer scrollable element --\u003e\n     \u003cimg v-lazy.container =\"imgUrl\"/\u003e\n     \u003cdiv v-lazy:background-image.container=\"img\"\u003e\u003c/div\u003e\n\n    \u003c!-- srcset --\u003e\n    \u003cimg v-lazy=\"'img.400px.jpg'\" data-srcset=\"img.400px.jpg 400w, img.800px.jpg 800w, img.1200px.jpg 1200w\"\u003e\n    \u003cimg v-lazy=\"imgUrl\" :data-srcset=\"imgUrl' + '?size=400 400w, ' + imgUrl + ' ?size=800 800w, ' + imgUrl +'/1200.jpg 1200w'\" /\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  import { ref, reactive } from 'vue'\n  export default {\n    setup () {\n      const imgObj = reactive({\n        src: 'http://xx.com/logo.png',\n        error: 'http://xx.com/error.png',\n        loading: 'http://xx.com/loading-spin.svg'\n      })\n      const imgUrl = ref('http://xx.com/logo.png') // String\n\n      return { imgObj, imgUrl }\n    }\n  }\n\u003c/script\u003e\n```\n\n### CSS state\n\nThere are three states while img loading\n\n`loading`  `loaded`  `error`\n\n```html\n\u003cimg src=\"imgUrl\" lazy=\"loading\"\u003e\n\u003cimg src=\"imgUrl\" lazy=\"loaded\"\u003e\n\u003cimg src=\"imgUrl\" lazy=\"error\"\u003e\n```\n\n```html\n\u003cstyle\u003e\n  img[lazy=loading] {\n    /*your style here*/\n  }\n  img[lazy=error] {\n    /*your style here*/\n  }\n  img[lazy=loaded] {\n    /*your style here*/\n  }\n  /*\n  or background-image\n  */\n  .yourclass[lazy=loading] {\n    /*your style here*/\n  }\n  .yourclass[lazy=error] {\n    /*your style here*/\n  }\n  .yourclass[lazy=loaded] {\n    /*your style here*/\n  }\n\u003c/style\u003e\n```\n\n\n\n## Methods\n\n### Event Hook\n```javascript\nimport { getCurrentInstance, inject } from 'vue'\nexport default {\n  setup() {\n    const internalInstance = getCurrentInstance().appContext.config.globalProperties\n    const LazyLoad = internalInstance.$Lazyload\n    // or\n    const Lazyload = inject('Lazyload')\n\n    Lazyload.$on(event, callback)\n    Lazyload.$off(event, callback)\n    Lazyload.$once(event, callback)\n  }\n}\n```\n- `$on` Listen for a custom events `loading`, `loaded`, `error`\n- `$once` Listen for a custom event, but only once. The listener will be removed once it triggers for the first time.\n- `$off` Remove event listener(s).\n\n#### `Lazyload.$on`\n\n#### Arguments:\n\n* `{string} event`\n* `{Function} callback`\n\n#### Example\n\n```javascript\nLazyload.$on('loaded', function ({ bindType, el, naturalHeight, naturalWidth, $parent, src, loading, error }, formCache) {\n  console.log(el, src)\n})\n```\n\n#### `Lazyload.$once`\n\n#### Arguments:\n\n* `{string} event`\n* `{Function} callback`\n\n#### Example\n\n```javascript\nLazyload.$once('loaded', function ({ el, src }) {\n  console.log(el, src)\n})\n```\n\n#### `Lazyload.$off`\n\nIf only the event is provided, remove all listeners for that event\n\n#### Arguments:\n\n* `{string} event`\n* `{Function} callback`\n\n#### Example\n\n```javascript\nimport { getCurrentInstance, inject } from 'vue'\nexport default {\n  setup() {\n    const internalInstance = getCurrentInstance().appContext.config.globalProperties\n    const LazyLoad = internalInstance.$Lazyload\n    // or\n    const Lazyload = inject('Lazyload')\n\n    const handler = ({ el, src }, formCache) =\u003e {\n      console.log(el, src)\n    }\n    Lazyload.$on('loaded', handler)\n    Lazyload.$off('loaded', handler)\n    Lazyload.$off('loaded')\n  }\n}\n```\n\n### LazyLoadHandler\n\n`Lazyload.lazyLoadHandler`\n\nManually trigger lazy loading position calculation\n\n#### Example\n\n```javascript\nimport { getCurrentInstance, inject } from 'vue'\nexport default {\n  setup() {\n    const internalInstance = getCurrentInstance().appContext.config.globalProperties\n    const LazyLoad = internalInstance.$Lazyload\n    // or\n    const Lazyload = inject('Lazyload')\n\n    Lazyload.lazyLoadHandler()\n  }\n}\n```\n\n### Performance\n\n```javascript\nimport { getCurrentInstance, inject } from 'vue'\nexport default {\n  setup() {\n    const internalInstance = getCurrentInstance().appContext.config.globalProperties\n    const LazyLoad = internalInstance.$Lazyload\n    // or\n    const Lazyload = inject('Lazyload')\n\n    Lazyload.$on('loaded', function (listener) {\n      console.table(Lazyload.performance())\n    })\n  }\n}\n```\n\n![performance-demo](http://ww1.sinaimg.cn/large/69402bf8gw1fbo62ocvlaj213k09w78w.jpg)\n\n### Dynamic switching pictures\n\n```vue\n \u003cimg v-lazy=\"lazyImg\" :key=\"lazyImg.src\"\u003e\n```\n\n# Authors \u0026\u0026 Contributors\n\n- [hilongjw](https://github.com/hilongjw)\n- [imcvampire](https://github.com/imcvampire)\n- [darrynten](https://github.com/darrynten)\n- [biluochun](https://github.com/biluochun)\n- [whwnow](https://github.com/whwnow)\n- [Leopoldthecoder](https://github.com/Leopoldthecoder)\n- [michalbcz](https://github.com/michalbcz)\n- [blue0728](https://github.com/blue0728)\n- [JounQin](https://github.com/JounQin)\n- [llissery](https://github.com/llissery)\n- [mega667](https://github.com/mega667)\n- [RobinCK](https://github.com/RobinCK)\n- [GallenHu](https://github.com/GallenHu)\n- [Jambon](https://github.com/jambonn)\n\n# License\n\n[The MIT License](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjambonn%2Fvue-lazyload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjambonn%2Fvue-lazyload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjambonn%2Fvue-lazyload/lists"}