Home > Web Front-end > JS Tutorial > Detailed explanation of router-link parameter passing and use of parameters in vue

Detailed explanation of router-link parameter passing and use of parameters in vue

小云云
Release: 2017-12-22 11:33:38
Original
7190 people have browsed it

This article mainly explains the vue router-link parameter passing and parameter usage examples in detail. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let's follow the editor and take a look. I hope it can help you master the router-link parameter transfer and the use of parameters in vue.

1. Path: http://localhost:8081/#/test?name=1

<router-link :to="{path:&#39;/test&#39;,query: {name: id}}">
Copy after login

Jump(id is a parameter)

Use: this.$route.query.id

2. Path: http://localhost:8081/#/test/1

<router-link :to="&#39;/test/&#39;+id">
Copy after login

Jump(id is a parameter)

Route:

##Use: this.$route.params.id(This id is given to Related to the configuration of the map route)

this.$route is an array, which contains all the information of the route

Note: If the link in router-link starts with '/', it starts from the root route , if it does not start with '/', it starts from the current route.

Related recommendations:

vue router uses jquery and params to pass parameter analysis

detailed explanation of js anonymous function usage and parameter passing examples

How to understand types, parameters and execution environments in JavaScript

The above is the detailed content of Detailed explanation of router-link parameter passing and use of parameters in vue. 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