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

2023-09-05  本文已影响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();
    }
  },
上一篇 下一篇

猜你喜欢

热点阅读