自学内容网 自学内容网

随手记: vue监听路由

随手记:没空记详细

newVal,oldVal 可以查看到最新路由和上一条路由详细

  watch: {
    $route: {
      handler(newVal,oldVal) {
        console.log(newVal, oldVal)
        if(oldVal.path == '/organization/serviceManagement/list') {
          if(this.cacheId != newVal.query.id) {
            this.cacheId = newVal.query.id;
            this.queryParams.id = newVal.query.id;
            this.getList();
          }
        }
      }
    },
    deep: true,
  },


原文地址:https://blog.csdn.net/weixin_63515766/article/details/143950181

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!