刷新页面时,Vue 3 路由器链接没有活动类

时间:2021-03-24 20:24:58

标签: vue.js vuejs2 vuejs3 routerlink

当我点击某个链接时,会出现“router-link-active”类。当我刷新页面时,类名消失了。有谁知道有什么问题?我找不到任何解决方案。

<template>
  <aside v-if="pageListWithoutNav.indexOf($route.name) < 0" class="nav-container">
    <router-link class="nav-link" :to="{ name: 'Home', params: { params: 'test' }}">
      <span class="icon-home1 nav-icon"/>
      <span>Home</span>
    </router-link>
    <router-link class="nav-link" :to="{ name: 'Categories', params: { params: 'test' }}">
      <span class="icon-grid_large_view nav-icon"/>
      <span>Categories</span>
    </router-link>
    <router-link class="nav-link" :to="{ name: 'Screens', params: { params: 'test' }}">
      <span class="icon-macbook nav-icon"/>
      <span>Screens</span>
    </router-link>
  </aside>
</template>

0 个答案:

没有答案