zoukankan      html  css  js  c++  java
  • router-link params传参

    1、router.js配置

    需要在路径后定义上要传的属性名 --》       /:属性名(query方式不需要)

    {
      path: '/CreateProgress/:name1',
      name: 'CreateProgress',
      component:CreateProgress
    }
    2、传参
    与query不同的是  params是根据路由的name跳转的   而query是根据 path跳转的
    <router-link :to="{name:'CreateProgress',params:{name1:'haha',name2:'enen'}}" target="_blank">xxxxx</router-link>
     
    3、接受参数的方式和query相同
    this.$route.params
    this.$route.params.name1
     
    query是
    this.$route.query
    this.$route.query.name1
     
     
    当然 用params方式传参时,同时也可以用query方式传参
    <router-link :to="{ name:'CreateProgress',params: { name1: '参数'},query: { queryId: status2 }}" >xxxxx</router-link>
    接受方式 按照自己的接受方法接受 就行
     
     
     
    也可以使用编程式跳转    是$router而不是$route    要跟接受参数的区分清楚
    this.$router.push({ name:'CreateProgress',params: { name1:'参数'},query: { queryId: status2 }});
    可以用click事件来触发
  • 相关阅读:
    0111. Minimum Depth of Binary Tree (E)
    0735. Asteroid Collision (M)
    0133. Clone Graph (M)
    1007. Minimum Domino Rotations For Equal Row (M)
    2018-8-10-win10-uwp-关联文件
    2018-2-13-win10-uwp-手动锁Bitlocker
    2018-2-13-win10-uwp-切换主题
    jquery开关灯
    jquery隔行变色
    jquery体验
  • 原文地址:https://www.cnblogs.com/fqh123/p/9927569.html
Copyright © 2011-2022 走看看