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,说的再简单一点,前者在浏览器地址栏中显示参数,后者则不显示

    
    
  • 相关阅读:
    学习网站
    支付宝调用错误:Call to undefined function openssl_sign()
    打包APP
    PHP 转义
    tp5学习
    js函数
    php学习随笔--定时触发
    day07
    60.函数应用:学生管理系统
    59.列表推导式
  • 原文地址:https://www.cnblogs.com/wanan-01/p/10131452.html
Copyright © 2011-2022 走看看