美文网首页
elementui面包屑导航简单逻辑

elementui面包屑导航简单逻辑

作者: Victor_818 | 来源:发表于2020-03-09 13:43 被阅读0次
let routeList = [];
router.beforeEach((to, from, next) => {
  let index = -1;
  for (let i = 0; i < routeList.length; i++) {
    if (routeList[i].name === to.name) {
      index = i;
      break;
    }
  }
  if (index !== -1) {
    //如果存在路由列表,则把之 后的路由都删掉
    routeList.splice(index + 1, routeList.length - index - 1);
  } else if (to.name !== 'login') {
    routeList.push({ name: to.name, path: to.fullPath, title: to.meta.title });
  }
  to.meta.routeList = routeList;
  next();
});

相关文章

网友评论

      本文标题:elementui面包屑导航简单逻辑

      本文链接:https://www.haomeiwen.com/subject/ducpdhtx.html