Computed Bootstrap Breakpoints in Nuxt js

Viewed 288

What is the best solution for having live active Bootstrap breakpoints of screen like a computed data in client side only in a NuxtJs app?

In Bootstrap we have classes like d-lg-block. I want to do that with v-if in VueJs. Like: <div v-if="lgAndUpper"></div>

1 Answers

You probably need this. This event will be fired once browser being resized. you can put it in mounted() to get it work.

window.addEventListener("resize", function(event) {
    console.log(document.body.clientWidth + ' wide by ' + document.body.clientHeight+' high');
})
Related