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

How to communicate between routes in Vue? Method introduction

青灯夜游
Release: 2020-11-04 17:39:31
forward
2146 people have browsed it

The following Vue.js tutorial column will introduce to you the method of passing props to routing components in Vue. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

How to communicate between routes in Vue? Method introduction

The component communication between father and son is realized through props and $emit, so what about the communication between routes, look down:

I am now There is such a structure in webpack,

Now I want to click the button in test1 to jump to test2, and get the id and age passed by test1,

We can write routing like this:

{
      path: "/test2/:id/:age",
      component:test2,
      // props:{id:"fang",age:18}
      props:true
    }
Copy after login

test1.vue:

test2.vue:

Effect:

Comparison written by me It's simpler. You can read the official documentation for details. If you don't know, let's share it together.

Related recommendations:

2020 Summary of Front-End Vue Interview Questions (With answers)

vue tutorial recommendation: The latest 5 vue.js video tutorial selections in 2020

More programming-related knowledge, Please visit: Introduction to Programming! !

The above is the detailed content of How to communicate between routes in Vue? Method introduction. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
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