How do I create a navbar for a single-pae-app in Vue?

I’m working on a single-page app in Vuejs and I’m wondering how I create a navbar that shows/hides different sections of the app based on what I click. I have the navbar laid out, I just need to figure out how to make it show/hide components. I tried to make the navbar component modify an array that tells my app which components to display, but it can’t access the array. What should I do instead?

1 thought on “How do I create a navbar for a single-pae-app in Vue?”

  1. If you’re not using Vue-Router, this may be what you’re looking for.

    Vue-Router would be preferable in most Vue SPAs though.

    <!DOCTYPE html>
      <link href=",300,400,500,700,900" rel="stylesheet">
      <link href="" rel="stylesheet">
      <link href="" rel="stylesheet">
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
      <div id="app">
          background-color="blue accent-4"
          :prev-icon="prevIcon ? 'mdi-arrow-left-bold-box-outline' : undefined"
          :next-icon="nextIcon ? 'mdi-arrow-right-bold-box-outline' : undefined"
            v-for="i in tabs"
            Tab {{ i }}
            v-for="i in tabs"
            :value="'tab-' + i"
              <v-card-text>{{ text }}</v-card-text>
      <script src=""></script>
      <script src=""></script>
        new Vue({
          el: '#app',
          vuetify: new Vuetify(),
          data: () => ({
          tab: null,
            text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
            icons: false,
            centered: false,
            grow: false,
            vertical: false,
            prevIcon: false,
            nextIcon: false,
            right: false,
            tabs: 3,

Leave a Comment