vue page jump - carry parameters

Original link: http://www.cnblogs.com/DreamerLeaf/p/10875820.html

vue page jump - carry parameters

1. The first <router-link to = '/ trip'> </ router-link>

<router-link to="/miniCard/statement/horizon">
     <button class="btn btn-default">点击跳转</button>
</router-link>

Jump achieve 2.js

<button @click = "func()">跳转</button>

//js
<script>
    export default{
        methods:{
            func (){
                this.$router.push({name: '/order/page1',params:{ id:'1'}});
                //this.$router.push({path: ''/order/index''});
               //this.$router.push({path: '/order/page1',query:{ id:'2'}});
            }
        }
    }
</script>

Routing parameter passing params and query the difference between the two approaches:

1, the instructions on the

    Have already said, query use the path to introduce, params to use the name to introduce, receive parameters are similar, namely the this. $ Route .query.name and this. $ Route.params.name. Note reception parameters, is already $ route rather than the $ router Oh! !

2, showing on

    ajax query is more similar to what we get in mass participation, params is similar to the post, and then said simply, former parameters to appear in the browser address bar, the latter will not be displayed

Reproduced in: https: //www.cnblogs.com/DreamerLeaf/p/10875820.html

Guess you like

Origin blog.csdn.net/weixin_30540691/article/details/94804550