There is a problem in the project: click the list page or some filter criteria to search the list, click to view the details of a certain item, and return the original filter criteria.

  1. Add to meta when adding routeskeepAlive: true,

2. Set a variable in data that controls whether to refreshcreatedSet this variable to true

data(){
    return{
        isCreated: false}},created(){
    this.isCreated = true
}
Copy the code
  1. resetIs a function of the reset condition,queryFor the function that loads the list, refresh the list (with arguments) when these specific names are returned
beforeRouteEnter(to, from, next) {
    next(vm= > {
      if (
        from.name ! ="createContract" &&
        from.name ! ="createPerContract" &&
        !vm.isCreated
      ) {
        vm.reset();
      } else if((from.name == "createContract" || from.name == "createPerContract") &&
        !vm.isCreated
      ) {
        console.log("vm.pageJson.page :>> ", vm.pageJson.page); vm.query(vm.pageJson.page); }}); },beforeRouteLeave(to, from, next) {
    this.isCreated = false;
    next();
  }
Copy the code