How does the secondary page navigation bar of vue highlight?

for example, the navigation bar has two buttons with the following address:

www.xxx.com/page1/A.vue
www.xxx.com/page2/B.vue

at this time, there are secondary pages called A1.vue and B1.vue in An and B

www.xxx.com/page1/subpage1/A1.vue
www.xxx.com/page2/subpage2/B1.vue

clipboard.png

.().


clipboard.png

A1B1,page1page2,,;

is there any way to highlight a child page as soon as it is loaded?


you can configure the routing of this area by using json
such as

{
  name: 'two',
  path: '/two',
  meta: {
    level:'two'
  },
  component: () => import('pages/B.vue')
},

then judge the route through beforeRouterEnter, and then add class
to

<ul>
 <li>
     <nuxt-link to="/subpage1/A">A</nuxt-link>
 </li>
 <li>
     <nuxt-link to="/subpage2/B">B</nuxt-link>
 </li>
</ul>

this also renders dynamically

Menu