[Vuejs]-Make the first child route as the active class whenever the sub-route path is an empty path

0👍

With @Potray’s advice, I ended up checking the $route.path and the child path inside the template.

<template>
    <div id="homeSubMenuWrapper">
        <ul id="subMenuList">
            <li v-for="menu in menuList">
                <router-link  :class="[$route.fullPath ==='/' && menu.path === '/in-theaters' ? 'menuItem router-link-active' : 'menuItem']" :to="menu.path">{{menu.name}}</router-link>
            </li>
        </ul>
    </div>
</template>

Leave a comment