Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the differences between go and back in vue

Shulou Source: shulou.com Published: 2022-06-01 05:12:36 09月27日 Update

This article mainly explains "what is the difference between go and back in vue". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the difference between go and back in vue".

The differences between go and back in vue are: 1, using go () to return to the original page will refresh the interface, while using back () to return to the original page will not refresh; 2, using go () to return the content in the original page form will be lost, while using back () to return the original page form content will be retained.

This article operating environment: windows10 system, Vue2.9.6 version, DELL G3 computer.

What is the difference between go and back in vue

When you encounter the need to return to the previous page in development, there are two ways to choose:

1.$router.back ()

2.$router.go ()

Found in use, using r o u t e r. Back () and router.go (- 1) do the same thing, returning to the original page. However, if the original page route carries parameters, the original page routing parameters returned by the above two methods disappear, and the original page routing parameters returned using $router.back (- 1) still exist.

Go (- 1): the content in the original page form will be lost

This.$router.go (- 1): back + refresh

This.$router.go (0): refresh

This.$router.go (1): forward

Back (): the contents of the original page table form are retained

This.$router.back (): back up

This.$router.back (0) refresh

This.$router.back (1): forward

Thank you for your reading, the above is "what is the difference between go and back in vue?" after the study of this article, I believe you have a deeper understanding of the difference between go and back in vue, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Pages content parameters forms routing learning two methods the same function that is ideas situations articles more environment computer interface knowledge knowledge points Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Redmi Apple vpn OPPO Reno