The vue, button is traversed by v-for. Click each button to go to the specified page. The routing configuration section will not be written.

< section >

<div class="nav">
    <div class="nav_con">
        <router-link :to="{path:item.link,query:{title:item.title,category_id:item.id}}" class="nav_item" v-for="item in Nav" :key="item.id">
            <span class="nav_img"><img :src="item.icon"></span>
            <i class="nav_text">{{item.title}}</i>
        </router-link>
    </div>
</div>

< / section >

I defined link, in the local json, but not in the actual background data. I need to configure the route myself. I know it uses variables, but I just can"t write it.

Mar.02,2021

which part of the code will not write


it should be solved by flipping through official documents . Put a < router-view >

in the component.

routing configuration is as follows:

const router = new VueRouter({
  routes: [
    {
      path: '/user/:id', component: User,
      children: [
        //  /user/:id 
        // UserHome  User  <router-view> 
        { path: '', component: UserHome },

        // ...
      ]
    }
  ]
})
The value corresponding to the

path path is the path corresponding to the page you want to jump to


there is a more savage way to tell your background that the route name of your page (when the jump page is fixed)


serialize the json data to nav.

Menu