Update (seo)
Add (lqip)
This commit is contained in:
25
resources/js/vue/front/LqipLoader.vue
Normal file
25
resources/js/vue/front/LqipLoader.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user