vue-router 中的路径异步获取时导致的to报错问题

 v-if    item.path != undefined一定要加上,因为先渲染的页面再获取到url的值

<router-link v-if="(!item.systemMenuDtoList || (item.systemMenuDtoList && item.systemMenuDtoList.length <= 0)) && item.path != undefined" :to="item.path"
                     :key="item.menuCode">
          <el-menu-item :index="item.path" :class="{'submenu-title-noDropdown': !isNest}">
            <v-icon v-if="item.icon" :icon-class="item.icon"></v-icon>
            <span slot="title" style="margin-left: 20px;">{{$i18nAdapt('route.' + item.menuName)}}</span>
          </el-menu-item>
        </router-link>

猜你喜欢

转载自www.cnblogs.com/alww/p/12925706.html