C
C
Comnox2021-08-19 17:26:56
Vue.js
Comnox, 2021-08-19 17:26:56

[vue-router] Redirect to another page not working?

good afternoon, I ran into such a problem that when switching to another page using this.$router.push({ hash: "settings" }) the transition does not occur
routes in the component :

routes: [
    {
      path: "/settings",
      name: "app-settings",
      component: Settings,
    },
    {
      path: "/leasing/paymentshedule/:uuid",
      props: true,
      children: [
        {
          path: "",
          component: PaymentSheduleEditSectionBase,
          name: "leasing-ps-edit",
          props: { PaymentSheduleModel: PaymentSheduleModel },
        },
        {
          path: "details",
          component: PaymentSheduleEditSectionDetails,
          name: "leasing-ps-edit-details",
          props: { PaymentSheduleModel: PaymentSheduleModel },
        },
        {
          path: "api",
          component: PaymentSheduleEditSectionApi,
          name: "leasing-ps-edit-api",
          props: { PaymentSheduleModel: PaymentSheduleModel },
        },
      ],
    },
  ],


when I try to navigate to another page in the hook, I open a modal window with the "continue" / "cancel" buttons:
beforeRouteLeave(to, from, next) {
    this.showLeaveModal = true
    this.nextRoute = to.path;
  }


when I click on continue, I close the modal window and try to go to another page, but the path that I need is added to the end of the url
onSave() {
      this.showLeaveModal = false;
      this.$router.push({ hash: this.nextRoute }); 
    }


ps when navigating through pages that are in children in routes everything works

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question