When I write this .vue file, the v-if directive is resolved when running the nuxt generate
command. However, I would like to implement dynamic v-if instead. How can I achieve this?
<template>
<div v-if="foo()"></div>
</template>
<script>
export default {
methods:{
foo:function(){
/*
This method returns a boolean value. Currently, it is executed during `nuxt generate`,
but my goal is to have it run only when a user visits the page.
*/
}
}
}
</script>