export default {
methods: {
hotbod() { document.querySelector("body")},
doStuff() {
hotbod.className += " animate";
},
window:onload = function() {
doStuff();
},
},
}
Above is the code, that I think has some errors in it - and for some reason I cannot get the javascript to work (On page load, there are CSS that gets loaded).
To launch a component method on the window's load, simply add the load listener in your mounted() hook. For example:
mounted(){
window.addEventListener("load", () => this.processLoad());
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With