Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to pass parameters in vue routing

Shulou Source: shulou.com Published: 2022-05-31 13:25:01 10月03日 Update

This article mainly explains "how to transmit parameters in vue routing". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "vue routing how to transmit parameters" bar!

The specific methods are as follows:

1. Transfer parameters by routing through params

Use the name in the route attributes to match the route, passing parameters through params, but the page refresh data is lost.

Methods: {

Insurance (id) {

This.$router.push ({

Name: 'particulars'

Params: {

Id: id

}

})

}

two。 Transfer parameters by routing through query

Use path to match the route, passing parameters through query.

Methods: {

Insurance (id) {

This.$router.push ({

Path:'/ particulars'

Query: {

Id: id

}

})

}

3. Call $router.push to transfer parameters by route

Directly call $router.push to carry the jump of parameters, and the page refresh data will not be lost.

Methods: {

Insurance (id) {

This.$router.push ({

Path: `/ particulars/$ {id}`

})

}

At this point, I believe you have a deeper understanding of "how to transmit parameters in vue routing". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Routing parameters content data methods pages learning practicality deeper interest practicality practicality properties ease of operation more friends websites channels queries Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Linux Docker vpn Shulou Technology