Answer the question
In order to leave comments, you need to log in
How can I rewrite this code for vuejs?
Hello. Wrote this code:
$(window).on('load', () => {
if ($('#main-feed').length) {
let shadowDomTimeout = setTimeout(function () {
$('#shadow-dom').remove()
$('.true-dom').removeClass('is-hidden')
clearTimeout(shadowDomTimeout)
}, 2000)
}
})
Answer the question
In order to leave comments, you need to log in
You misunderstand what VueJS is. VueJS is a framework for developing "reactive" components. In your case, the code has nothing to do with Vue. Your example interacts with DOM elements, so you need to rewrite it to vanilla JS, and then call this code from Vue methods on an event or at the time of initialization (mount) of the
PS component, rewrite your code to vanilla JS in 1 minute, you unfortunately you can’t even solve this problem, but you are already trying to write in Vue. With this level of knowledge, you don't care for the time being, so I advise you to put VueJS aside and learn JS without impurities like jQuery and the like.
PSPS I also don’t even want to write for you, because the question (no offense) is really lamer and I really hope that noneAlyosha will not do this - otherwise he is a complete terpiloid! And for you it will be an experience that you will need further if you want to work in this direction.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question