#v-if logic

5 messages · Page 1 of 1 (latest)

mint monolith
#

I know this has to be a silly issue but I cannot figure it out.
In my screenshot, you can see I'm checking if isHome is true before HomeHeader displays, but no matter what, this component is displaying. I'm defaulting the ref to false and even when printing the value, it shows false. Is this maybe a lifecycle issue? This should be reactive either way, so I don't think it has to do with lifecycle.

hushed osprey
#
  • try deleting the useRoute import, Nuxt utils are available globally
  • not what you're asking about but since isMounted only runs once then this won't be fully reactive. I think you want to use computed which will recalculate whenever the path changes.
const isHome = computed(() => route.path === '/');
mint monolith
#

Oh man, I knew it was something stupid, I just spotted it.

#

I had the bind directive on it for some reason