Sign in

The return key of the mobile phone can only return to the previous route. How can I return to the parent route directly?

diogenes edited in Wed, 03 Nov 2021

![clipboard.![ clipboard.mGK )mGJ)



In the first picture, click to enter the details page. There are four routes. The top is the parent route, and the bottom three switch to one route. Now the problem is, I click the selection (from Figure 2 to figure 3), but I click the return key of Android phone, and I can only change back to figure 1 by repeating Figure 2 , is to return to the previous sub route. I want to return to figure 1 directly. How do you implement this

4 Replies
commented on Wed, 03 Nov 2021

Refer to "monitor phone buttons". Address: Android interacts with Vue

commented on Wed, 03 Nov 2021

1. There are two methods. One is Vue router encapsulated method, which directly uses this$ router.push ({path: '/ route corresponding to figure 1}) 2 window.open ( location.origin +I hope it can help you

commented on Wed, 03 Nov 2021

First of all, are you wrong: you can only bring back from Figure 2 to figure 1. Finally, you want to go back to figure 1 directly. Isn't that the same meaning?

  • 1. If you want to go back to figure 1, use this when Figure 2 jumps to figure 3$ router.replace (Figure 3 route), and the return will go directly to figure 1.
  • 2. Or: judge in the route in Figure 2, and judge in before route enter. if( from.path== "Figure 3") {this$ router.replace (Figure 1)

But 1 is recommended

commented on Wed, 03 Nov 2021

Have you solved your problem

lock This question has been locked and the reply function has been disabled.