[Vuejs]-How can I use v-if dynamically with Nuxt.js generate?

1👍

I think you should use vue lifecycle named ‘mounted’. Create a data named for example ‘isMounted’ and set it to true.

data() {
  return {
    isMounted: true
  }
}

then use it in your html as:

<div v-if="isMounted"></div>

Then change its value in the mounted lifecycle as follows:

mounted(){
 this.isMounted = this.foo();
}

Leave a comment