如下图使用path时,跳转路由后的页面this.$route.params为undefined

改为name时,this.$route.params可以正确获取数据,如下图:

此为官方定义的固定搭配:
 
   //命名的路由
     this.$router.push({
          name:'parkingOrderView',
          params:val
      })
 
    <router-link  :to="{name:'parkingOrderView',params:scope.row}"></router-link>
 
  
 // 带查询参数,变成 /parking-order-view?plan=private
     this.$router.push({
          path:’/parking-order-view',
          query: { plan: 'private' }
      })
 
    <router-link :to="{path: '/parking-order-view'', query: {index: index}}”></router-link> 

vue-router: $router.push遇到的问题的更多相关文章

  1. vue中$router.push打开新窗口

    在vue中使用 this.$router.push({ path:  '/home' }) 默认是替代本窗口 如果想新开一个窗口,可以使用下面的方式: let routeData = this.$ro ...

  2. Vue this.$router.push、replace、go的区别

    1.this.$router.push 描述:跳转到不同的url,但这个方法会向history添加一个记录,点击后会返回到上一个页面 用法 //字符串 this.$router.push('home' ...

  3. vue this.$router.push query传递对象方法

    this.$router.push({ path: '/home', query: { params: JSON.stringify({ name: 'lokka', age: 18 }) } }); ...

  4. vue this.$router.push和this.$route.path的区别

    this.$router 实际上就是全局路由对象任何页面都可以调用 push(), go()等方法: this.$route  表示当前正在用于跳转的路由器对象,可以调用其name.path.quer ...

  5. vue this.$router.push 页面不刷新

    解决办法: 使用 watch,观察路由,发生变化重新获取数据 <script> export default { data() { return { data: {} } }, metho ...

  6. vue router.push(),router.replace(),router.go()

    1.router.push(location)=====window.history.pushState 想要导航到不同的 URL,则使用 router.push 方法.这个方法会向 history ...

  7. vue router.push(),router.replace(),router.go()和router.replace后需要返回两次的问题

    转载:https://www.cnblogs.com/lwwen/p/7245083.html https://blog.csdn.net/qq_15385627/article/details/83 ...

  8. 【Vue】【Router】手动跳转用 this.$router.push() 时 $router 未定义的问题

    初入Vue,手写路由跳转时的问题: toXxxRoute: () => { this.$router.push({'path': '/xxx', 'name': 'xxx'}) } 由于使用了箭 ...

  9. Vue页面跳转$router.push 的用法

    vue2.0在使用的过程中, .vue文件之间的跳转,在template中的常见写法是: <router-link to="/miniCard/statement/horizon&qu ...

  10. vue.js 中this.$router.push()的使用

    在vue项目中,跳转可以用router-link直接跳到某个页面 因为有时候会需要做一些判断等情况,所以要用到 this.$router.push() 因为外链跳转根本就不在router的设计考虑范围 ...

随机推荐

  1. 深度学习主机环境配置: Ubuntu16.04+Nvidia GTX 1080+CUDA8.0

    不多说,直接上干货! 深度学习主机环境配置: Ubuntu16.04+Nvidia GTX 1080+CUDA8.0

  2. IOS 字典模型互转框架 MJExtension

    IOS 字典模型互转框架 MJExtension   能做什么? MJExtension是一套字典和模型之间互相转换的超轻量级框架 MJExtension能完成的功能 字典(JSON) -->  ...

  3. TF-IDF与余弦类似性的应用(一):自己主动提取关键词

    作者: 阮一峰 日期: 2013年3月15日 原文链接:http://www.ruanyifeng.com/blog/2013/03/tf-idf.html 这个标题看上去好像非常复杂,事实上我要谈的 ...

  4. Receiver type ‘X’ for instance message is a forward declaration

    这往往是引用的问题. ARC要求完整的前向引用,也就是说在MRC时代可能仅仅须要在.h中申明@class就能够,可是在ARC中假设调用某个子类中未覆盖的父类中的方法的话.必须对父类.h引用,否则无法编 ...

  5. 在myeclipse中拷贝一个工程,修改部署的名字

        在MyEclipse中,经常练习的时候需要建立多个工程,但是为了方便,通常的作法是:复制一个工程,然后直接粘贴,但是,部署以后会发现,使用新的工程名访问不了,报404错误. 其原因是没有修改W ...

  6. execute ps1 with pwsh.exe

    pwsh -file C:\Users\clu\source\repos\Edenred\LISA_5.0.0.0\LISA.ControlPanel\LISA.ControlPanel\bin\Re ...

  7. YTU 2915: Shape系列-1

    2915: Shape系列-1 时间限制: 1 Sec  内存限制: 128 MB 提交: 283  解决: 221 题目描述 小强开始迷恋彩色的Shape,于是决定做一个Shape类.Shape类有 ...

  8. YTU 2905: The Sum of 1...N

    2905: The Sum of 1...N 时间限制: 1 Sec  内存限制: 128 MB 提交: 281  解决: 51 题目描述 Given an integer n,your task i ...

  9. 《Visual C++ 2010入门教程》系列六:VC2010常见调试技术

    <Visual C++ 2010入门教程>系列六:VC2010常见调试技术   犹豫了好久,最终还是决定开始这一章,因为我不清楚到底有没有必要写这样的一章,是应该在这里说明一些简单的调试方 ...

  10. HTTP传输二进制初探

    [转]HTTP传输二进制初探 http://www.51testing.com/?uid-390472-action-viewspace-itemid-233993 [转]HTTP传输二进制初探 上一 ...