Get the App
SLTechnology News&Howtos  ›  Development  › 

How does vuejs return to the previous page

Shulou Source: shulou.com Published: 2022-06-02 19:21:41 10月04日 Update

This article mainly explains "how to return to the previous page of vuejs". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to return to the previous page of vuejs".

Vuejs implementation returns a page of the method: 1, through the "goOff () {this.$router.go (- 1);}," method implementation click to return to the previous page; 2, through the "methods: {back () {if () {...}" way to return to the previous page, if there is no previous page, return to the home page.

This article operating environment: windows7 system, vue2.9.6 version, DELL G3 computer.

How does vuejs return a page?

The vue implementation clicks the button to return to the previous page:

How do I click the button to return to the previous page?

This is the range html code for vue mounts

Return

Here is how to click back

The first only returns to the previous page.

GoOff () {this.$router.go (- 1);}

The second method returns to the previous page, or to the home page if there is no previous page.

Methods: {back () {if (window.history.length {/ / skillfully use the arrow function if (! res) {return;} this.allProfit = res.Profit / / res is all the data returned in the background that needs to be received and saved})}} Thank you for your reading. This is the content of "how vuejs returns to the previous page". After the study of this article, I believe you have a deeper understanding of how vuejs returns to the previous page, and the specific usage still 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: Previous interface parameter is method this is learning content function background button way knowledge home page ingenuity code front end address idea situation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Information Huawei Apple MySQL