美文网首页
vue获取路由生命周期返回时请求数据

vue获取路由生命周期返回时请求数据

作者: 我叫杨毅 | 来源:发表于2023-09-05 13:32 被阅读0次
  // watch: {
  //   $route(to, from) {
  //     console.log("路由变化了");
  //     console.log("当前页面路由:" + to.path);
  //     console.log("上一个路由:" + from);
  //     debugger
  //   },
  // },

  beforeRouteEnter(to, from, next) {

    console.log("beforeRouteUpdate", to, from);
    if (from.name === "TodoRecord") {
      next((vm) => {
        vm.getList();
      });
    } else {
      next();
    }
  },

相关文章

网友评论

      本文标题:vue获取路由生命周期返回时请求数据

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