Level 47
vue has load directive , you can use it.
<template>
<div @load="dosth">
</div>
</template>
<script setup>
const dosth = () => {
//do something...
}
</script>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to have a preloader that appears until all the resources has been loaded.
import { onMounted, ref } from "vue";
const hasLoaded = ref(false);
onMounted(() => {
window.addEventListener('load', () => {
hasLoaded = !hasLoaded;
});
});
I just want to ask if this is just fine? Like, I'm not violating rules, semantics, conventions or anything?
Please or to participate in this conversation.