How can I rewrite this code to vuejs?

Hello. Wrote here such code:
$(window).on('load', () => {
 if ($('#main-feed').length) {
 let shadowDomTimeout = setTimeout(function () {
$('#shadow-dom').remove()
$('.true-dom').removeClass('is-hidden')
clearTimeout(shadowDomTimeout)
 }, 2000)
}
})


And it is necessary to rewrite under vuejs. Have tried my own ways but nothing came of it.
April 7th 20 at 11:56
2 answers
April 7th 20 at 11:58
Solution
You are right imagine what VueJS. VueJS is a framework created to develop "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 have to call this code from methods Vue at the event or in the initialize (mount) component

PS to rewrite your code to vanilla JS case 1 minutes, unfortunately you can not solve even this problem, but trying to write on the Vue. With this level of knowledge you still the way ordered, so I suggest to postpone VueJS and to learn JS without impurities such as jQuery and things like that.

P. S. P. S to write for you, too, not even a desire, because the question (no offense) really lamerskie and I hope that none of Alesha won't do it or he washed terpenoid! And for you it will be an experience that you will need on if you want to work in this direction
Thanks, I'll try to Express in code what you said - Adela.Hartma commented on April 7th 20 at 12:01
April 7th 20 at 12:00
Solution
@neil.Corwin said it right.
But just for your understanding, something like this would be "look at the vue":
<template>
the <div>
...
 <div id="shadow-dom" v-if="isTrueDomHidden"> ... </div>
 <div class="true dom" :class="{'is-hidden': isTrueDomHidden}"> ... </div>
...
</div>
</template>

the <script>
export default {
 data() {
 return {
 mainFeed: [], // mainFeed is supposed to be and get somewhere in another place inside the vue
 isTrueDomHidden: true
}
},
 mounted() {
 if (this.mainFeed.length) setTimeout(() => {
 this.isTrueDomHidden = false;
 }, 2000);
}
};
</script>
Thank you. - Adela.Hartma commented on April 7th 20 at 12:03

Find more questions by tags Vue.js