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

小云云
小云云Original
2017-12-22 11:33:387157browse

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}}">

Jumpd625018d6d57dc2163f3a71531b24864(id is a parameter)

Use: this.$route.query.id

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

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

Jump0e259af55a139990f31da244f503061c(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!

Statement:
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