< router-link > how to pass parameters?

<div class="title">
    <span></span>
    <router-link to="/buy_car">go</router-link>
</div>

I want to click on this < router-link >, jump to the route / buy_car, and pass several parameters to / buy_car at the same time

how should I write in
1 and < router-link >? How does the route
2 and / buy_car get the parameters passed in?

reply to comments

Mar.01,2021

router-link passes parameters in the following ways
1.params passes parameters

path='/buy_car/:id' // 
<router-link to="/buy_car/1">go</router-link>// 
this.props.history.params.id //

2. Pass
3 through querystring Pass

through state
<router-link to={{ path: '/buy_car', state: {a: '1'}}}>go</router-link>

this.props.history.state //

<router-link :to="{ name: 'buy_car', query: { userId: 123 }}">go</router-link>

// :
computed: {
    mess: function () {
        if(!this.$route.query.userId){
            return 'haha'
        }
        else{
            return this.$route.query.userId;
        }
    }
}

reference: https://codeshelper.com/q/10.

Menu