<template>
  <!-- Empty template -->
</template>

<script>
export default {
  name: "LqipLoader",
  mounted() {
    this.initLqipLoading();
  },
  methods: {
    initLqipLoading() {
      const imgDefer = document.getElementsByTagName("img");
      for (let i = 0; i < imgDefer.length; i++) {
        if (imgDefer[i].getAttribute("data-src")) {
          imgDefer[i].onload = function () {
            this.classList.remove("lqip-blur");
          };
          imgDefer[i].setAttribute("src", imgDefer[i].getAttribute("data-src"));
        }
      }
    },
  },
};
</script>
