zoukankan      html  css  js  c++  java
  • vue-cli 跳转方式

    一:router-link标签跳转

     <router-link to='/citylist'><div class="header-right">城市</div></router-link>
    <router-link :to="{path:'/partysubject',query:{id:3}}"></router-link>

    二:

    <button @click = "func()">跳转</button>
    <script>
        export default{
            methods:{
                func (){
                    this.$router.push({name: '/order/page1',params:{ id:'1'}});
                }
            }
        }
    </script>

    补充一下第二点:

    this.$router.push({path: ''/order/index''});
    this.$router.push({path: '/order/page1',query:{ id:'2'}});
    this.$router.push({name: '/order/page2',params:{ id:'6'}});

    query要用path来引入,params要用name来引入,接收参数都是类似的,分别是this.$route.query.name和this.$route.params.name。

    query更加类似于我们ajax中get传参,params则类似于post,说的再简单一点,前者在浏览器地址栏中显示参数,后者则不显示

    
    
  • 相关阅读:
    HDU What Are You Talking About
    谷歌面试题
    POJ 2299 UltraQuickSort
    单链表排序
    HDU Hat’s Words
    C++ const关键字
    求二叉树任意两点间的距离
    HDU Phone List
    POJ 2352 Stars
    C++ volatile关键字
  • 原文地址:https://www.cnblogs.com/wanan-01/p/10131452.html
Copyright © 2011-2022 走看看