Pengambilan nested menu pada vuejs

Saya Mempunyai kode sidebar sbb

<aside class="sidebar">
        <ul>
            <li v-for="item in $router.options.routes" :key="item.path" :class="{ active: item.path === $router.currentRoute.path }" @click="collapsed(index,item)">
                <router-link :to="item.path">
                    <i :class="item.icon" class="icon"></i>
                    <span>{{item.name}}</span>
                </router-link>
                <ul class="ambil-children" v-if="(children)">
                    <li v-for="item in $router.options.routes" :key="item.path">
                    <router-link :to="item.path">{{ item.name }}</router-link>
                    </li>
                </ul>
            </li>
        </ul>
    </aside>

dan router di routerjs sbb

  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
      icon:"fa fa-home"
    },
    {
      path: '#users',
      name: 'User',
      icon:"fa fa-user",
      children:[{
        id:1,
        path:'/member',
        name:'Member',

      }]

      // route level code-splitting
      // this generates a separate chunk (about.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
    }
  ]

pertanyaan nya bagaimana cara mengambil children dari routerjs

avatar xyaep025
@xyaep025

13 Kontribusi 1 Poin

Dipost 5 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban