zoukankan      html  css  js  c++  java
  • vue之this.$route.params和this.$route.query的区别

    1.this.$route.query的使用

    A、传参数:

    this.$router.push({
             path: '/monitor',
             query:{
                   id:id,
              }
    })
    B、获取参数:
    this.$route.query.id
    C、在url中形式(url中带参数)
    http://172.19.186.224:8080/#/monitor?id=1
    D、页面之间用路由跳转传参时,刷新跳转后传参的页面,数据还会显示存在(项目中遇到此问题)
     
    2.this.$route.params的使用

    A、传参数:

    this.$router.push({
             name: 'monitor',
             params:{
                   id:id,
              }
    })
    B、获取参数:
    this.$route.params.id
    C、在url中形式(url中不带参数)
    http://172.19.186.224:8080/#/monitor
    D、页面之间用路由跳转传参时,刷新跳转后传参的页面,数据不存在(项目中遇到此问题)
     
  • 相关阅读:
    面试算法爱好者书籍/OJ推荐
    go语言——数据类型
    go编程规范
    Go语言常见语法错误
    go语言入门
    python——itertools
    linux sed使用
    python——optparse模块
    Linux基本配置
    文件包含
  • 原文地址:https://www.cnblogs.com/happybread/p/10156869.html
Copyright © 2011-2022 走看看