Answer the question
In order to leave comments, you need to log in
Why doesn't computed work in v-if?
There is a component:
<template lang="pug">
nav(v-if="showNav")
.nav-wrapper
ul#nav-mobile.left.hide-on-med-and-down
li
a(href="/") Home
li
a(href="/about") About
</template>
<script>
export default {
сomputed: {
showNav: function() {
return this.$store.getters.isAuthenticated;
},
}
}
</script>
[Vue warn]: Property "showNav" was accessed during render but is not defined on instance.
at <Navbar onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
at <RouterView>
at <App>
Answer the question
In order to leave comments, you need to log in
Why did you make another computed property for a computed property?
just try
...mapGetters(['isAuthenticated'])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question