vue通过router-link传参

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaogc_a/article/details/82597926

父组件:

<router-link :to="{path:'/merchantEdit' ,query: { id: scope.row.merchantId }}">
    <el-button v-if="author.indexOf('merchant_list_edit') != -1" size="small">编辑</el-button>
</router-link>

id: scope.row.merchantId这个是参数
子组件:
使用:this.$route.query.id获取

export default {
    props: ['id']
    data() {
        return {
            tempData: {
                merchantId: this.$route.query.id,
            }
}
}

猜你喜欢

转载自blog.csdn.net/xiaogc_a/article/details/82597926