How to jump to a page in vue.js
This article mainly introduces how to jump to the page in vue.js, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Vue.js page jump method: 1, in DOM respectively set back, forward, jump any page three buttons; 2, in the constructor to manipulate back, forward, jump any page three buttons, the method can be written in methods.
This article operating environment: windows10 system, vue.js 2.5.2, thinkpad T480 computer.
In general, we choose to use tags for page jumps in vue, but we can't directly manipulate DOM elements in the constructor, so how do we do page jumps in this case?
Now let's take a look at the implementation.
Step 1:
Let's first set up three buttons in DOM, which are "back", "forward" and "jump to any page".
Go back, forward, jump to any page.
The next step is to manipulate them in the constructor
When the back button is selected, the page jumps to the previous page
When the forward button is selected, the page jumps to the next page
When you select the Jump any Page button, the page jumps to any jump page
Except for the last jump to any page, the other two buttons need to have traces of history before they can jump.
Of course, the method should be written in methods:
Methods: {goback () {this.$router.go (- 1)}, forwards () {this.$router.go (1)}, goto () {this.$router.push ("/ about")}} Thank you for reading this article carefully. I hope the article "how to jump to a page in vue.js" shared by the editor will be helpful to you. At the same time, I also hope that you will support and pay attention to the industry information channel, and more related knowledge is waiting for you to learn!