Block created execution of router-view

  1. Click a menu on the left
  2. when judging that there is a certain sessionStorage value in the beforeCreate of index.vue
  3. if not, the route jumps to a selection page

(due to the complexity of the project, router interception cannot be written in the overall project, but can only be judged in the subitem destination index.vue)

all the above steps have been implemented, but there is a problem: the created of the menu page that
enters for the first time is executed, and there is the logic of API request, which is equivalent to sending multiple requests
asking: how to prevent the execution of created in the router-view of the page

Mar.28,2021

In-Component Guards

ide/advanced/navigation-guards.html-sharpper-route-guard" rel=" nofollow noreferrer "> beforeRouteEnter


has been solved. The direction is wrong. In dom, v-if directly controls router-view not to render before it has a value.

Menu