Home > Web Front-end > Vue.js > body text

How to make a jump page in vue.js

coldplay.xixi
Release: 2020-11-17 18:17:49
Original
4224 people have browsed it

Vue.js method to implement jump page: 1. Use tag [] to jump; 2. Use [this.$router.push()] method, when there is only one parameter, Represents the jump address, and can also add a parameter to pass the value.

How to make a jump page in vue.js

[Related article recommendations: vue.js]

##vue. How to implement page jump in js:

Click the bottom bookshelf to jump to the corresponding page

<router-link :to="{name: &#39;bookshelf&#39;, params: { entityId: this.entityId } }"
             :class="{&#39;flex-item-1&#39;:&#39;flex-item-1&#39;,cur:tabs[0].isShow}" href="javascript:">
              <span class="tabNav-ico tabNav-book"></span>
              <span class="tabNav-txt">书 架</span>
</router-link>
Copy after login

'name': 'bookshelf' indicates the name of the Vue component to be jumped, name It is set in index.vue under the router file.

{
     path: &#39;/bookshelf&#39;,
     name: &#39;bookshelf&#39;,
     component: Bookshelf
   },
Copy after login

params: {entityId: this.entityId} contains the parameters to be passed.

Receive parameters in bookshelf component

this.bookshelfId = this.$route.params.entityId;

In addition to using the label
<a @click="toIndex" :class="{&#39;flex-item-1&#39;:&#39;flex-item-1&#39;,cur:tabs[2].isShow}" href="javascript:">
      <span class="tabNav-ico tabNav-home"></span>
      <span class="tabNav-txt">首 页</span>
</a>
toIndex: function(){
        this.$router.push("/?entityId="+ localStorage.getItem("entityId"));
}
Copy after login

You can also jump to the page. When the this.$router.push() method has only one parameter, it represents the jump address. You can also add a parameter to pass value.

Writing:

this.$router.push({name: "deepReadingDetail", params: {&#39;id&#39;: data.id, &#39;title&#39;: data.title}});
Copy after login

Receive parameters:

this.$route.params.title

##Related free learning Recommended:
javascript

(Video)

The above is the detailed content of How to make a jump page in vue.js. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template