About going back to the previous page

1. Now there is such a demand

when I browse the goods from the store page (A page), click on the goods, go to the product details page (B page), then place the order and go to the order page (C page), but the user may need to select the receiving address. Or go to the receiving address page (D page), perform a series of operations, select an address, and jump to the order page (C page), but if the user does not select a transaction, Instead, click again to return

clipboard.png

if you use this.$router.go (- 1) to return to the previous page, you will return to the shipping address page (D page). If I use push to jump back to the product details page (B page), then the return page of my details will go back to the next single page again.
then thought about using replace, but there was a problem. How to deal with this problem now


after the C page, the data of the user's actions is stored in session. The jump between pages is done with ulr connection.


first of all, all returns are done with this.$router.go (- 1). For the D page to select the receiving address to call back the parameters to the C page, you can use vm.$on and vm.$emit
1. The C page uses vm.$on to define the event vm.$on to listen to ('test', msg = > console.log (msg))
2. Page D uses vm.$emit (' test', 'msg') to trigger the return function
page when choosing the receiving address. Try not to use push to deal with the return. There is a problem on the browser and the Android physical return key

Menu