如下图使用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. Xcode6 设置LaunchImage图标

    最近设置LaunchImage图标时发现怎么都没有效果,后来发现是Xcode6中新建项目的时候会默认添加一个LaunchScreen.xib的文件,我们启动程序的时候也会发现,加载的时LaunchSc ...

  2. hdu 2059 龟兔赛跑 (dp)

    /* 把起点和终点比作加油站,那总共同拥有n+2个加油站了, 每次都求出从第0个到第j个加油站(j<i)分别在加满油的情况下到第i个加油站的最短时间dp[i], 终于的dp[n+1]就是最优解了 ...

  3. How to use filters in a GridPanel

    You can just link statically required files in your index.html <link rel="stylesheet" t ...

  4. I.MX6 dhcpcd 需要指定网卡

    /************************************************************************** * I.MX6 dhcpcd 需要指定网卡 * ...

  5. 动态点分治入门 ZJOI2007 捉迷藏

    传送门 这道题好神奇啊……如果要是不带修改的话那就是普通的点分治了,每次维护子树中距离次大值和最大值去更新. 不过这题要修改,而且还改500000次,总不能每改一次都点分治一次吧. 所以我们来认识一个 ...

  6. AutoIT: GUISetFont VS GUICtrlSetFont

    GUISetFont 可以设置默认字体,后面的资源都会用该字体,而 GUICtrlSetFont 可以对特定控件的字体进行设置. ;Combo,setfont, GUICtrlSetFont $fon ...

  7. Python3列表、元组、字典、集合的方法

    一.列表 温馨提示:对图片点右键——在新标签页中打开图片: 1.count() 定义:统计指定元素在列表中出现的次数并返回这个数.若指定的元素不存在则返回:0. 格式:[列表].count(“指定元素 ...

  8. zoj 3861(dfs)

    Valid Pattern Lock Time Limit: 2 Seconds      Memory Limit: 65536 KB Pattern lock security is genera ...

  9. SAS基础 -- 逻辑库不存在问题解决

    SAS安装 -- 逻辑库不存在问题解决 1.SAS打不开,将系统时间改为系统提示错误的时间: 2.请在以下两个路径下,新建SASCFG文件夹(注意红色部分为你电脑SAS的安装路径)   D:\Prog ...

  10. bzoj 3398: [Usaco2009 Feb]Bullcow 牡牛和牝牛【dp】

    设f[i]为i为牡牛的方案数,f[0]=1,s为f的前缀和,f[i]=s[max(i-k-1,0)] #include<iostream> #include<cstdio> u ...