zoukankan      html  css  js  c++  java
  • vue 路由传参

     1、 this.$router.push进行编程式路由跳转

        2、 router-link 进行页面按钮式路由跳转

        3、 this.$route.params获取路由传递参数

        4、this.$route.query获取路由传递参数

        5、 params 和 query 都是传递参数的,params不会在url上面出现,并且params参数是路由的一部分,是一定要存在的 query则是我们通常看到的url后面的跟在?后面的显示参数

    方法一 

    this.$router.push({
                path:"/路径名字",
                query:{
                  id:id
                }
              })
    方法二
    this.$router.push({
                 name:"/路径名字",
                 params:{
                  id:id
                }
              })
    方法三
    this.$router.push('.路径名'+id)
     
     
    路由。index.js文件
     {
          //方式一 二路由路径
          path: '/路径名',
          //方式三路由路径
          // path: '/路径名:id',
          name: 'Xq',
          component: Xq
        },
     接受传过来的参数
        方法一接收
      this.$route.query.id
     
     <!--  方法二接收  -->
     this.$route.params.id
     
     <!--  方法三接收  -->
     this.$route.params.id
  • 相关阅读:
    Mybatis 内置 Java 类型别名与 typeHandlers
    泛型方法前为什么要加<T>
    jdbcTemplate学习(四)
    jdbcTemplate学习(三)
    jdbcTemplate学习(二)
    jdbcTemplate学习(一)
    博客园markdown toc
    office,ps 等入门教程链接
    mysql 手动加锁测试
    拆机联想ideapad s500
  • 原文地址:https://www.cnblogs.com/jackie-song/p/12787989.html
Copyright © 2011-2022 走看看