Vue current page routing click does not refresh

for projects written in vue, both editing and adding are on the same page, but the difference between whether to bring out the data by default
but after writing the editing function, we found that after clicking on the edit to enter the page, after clicking on the submission document on the menu, the page is not refreshed, and there is still data brought out when editing, as shown in the figure

.

clipboard.png
:

clipboard.png

looking up the information on the Internet, some people say that adding t: new Date () to the route can be refreshed, but it is not easy for me to write it. The code is as follows

this.$router.push({
    name: routename,
    query: {
        t: new Date()
    }
});

I hope someone with experience can give us some advice. Thank you

modify the page and component code according to the suggestion of the smiling Brother of the Society

menu page configure routing


<ul v-for="litem in item.children">
   <li :class="{"chil-active": isChilActive ===litem.flag}" @click="getName(litem.flag, litem.path)" class="dropdown-item">{{litem.txt}}
   </li>
</ul>

<script>

   watch: {
    // 1
    $route(to, from) {
      //
      alert(1)
      this.$router.push({ name: routename });
    }
  },
  methods: {
    getName(No, routename) {
      if (routename === "logout") {
        window.logout();
      } else {
        this.$router.push({ name: routename });
      }
      this.$store.commit("setStep", 0);
      this.isChilActive = No;
    }
  }

</script>

Edit and submit page routing configuration


created() {
    this.demandcode = this.$route.query.demandno;
    if (this.demandcode !== undefined) {
        // 
    }
}

trigger editing routes

// 
editNeeds(params) {
  console.log(params)
  if (params.row.demand_type === 0) {
    this.$router.push({
      name: "tollstep_1",
      query: {
        demandno: params.row.demand_code,
        edit: 1
      }
    });
  } else if (params.row.demand_type === 1) {
    this.$router.push({
      name: "gratisstep_1",
      query: {
        demandno: params.row.demand_code,
        edit: 1
      }
    });
  } else {
    this.showErrMag("");
  }
}
Oct.11,2021

https://codeshelper.com/a/11.
the first item of my article

Menu