我想要的路径:http://localhost:8080/#/main/hato/realtime/eventDetail/238

情况一:未进行路由配置:
 {
     path: 'eventDetail',
     name: 'eventDetail',
     component: () => import('@/views/security/alarm-management/eventDetail')
}

情况二:已进行路由配置

 {
     path: 'eventDetail/:id',
     name: 'eventDetail',
     component: () => import('@/views/security/alarm-management/eventDetail')
}
在情况一下:

路由用 name和params 路由跳转:http://localhost:8080/#/main/hato/realtime/eventDetail

路由用path和query路由跳转:http://localhost:8080/#/main/hato/realtime/eventDetail?id=238

const showButton = {

  props: ["scope"],
  render: function(h) {
    return (
      <div>
        <router-link to={{name: "eventDetail", params: {id: this.scope.row.id}}}>
          查看详情
        </router-link>
      </div>
    );
  }
};
在情况二下:

路由用 name和params 路由跳转:http://localhost:8080/#/main/hato/realtime/eventDetail/238

路由用path和query 下面这个路径很奇怪,所以vue在router.js里面有个name属性路由跳转:http://localhost:8080/#/main/hato/realtime/eventDetail/:id?id=238

const showButton = {
  props: ["scope"],
  render: function(h) {
    return (
      <div>
        <router-link to={{path: "eventDetail/:id", query: {id: this.scope.row.id}}}>
          查看详情
        </router-link>
      </div>
    );
  }
};
总结:query要用path来引入,params要用name来引入

Vue router-link路由不同的写法,不一样的效果的更多相关文章

  1. Vue router 一个路由对应多个视图

    使用命名路由 https://jsfiddle.net/posva/6du90epg/ <script src="https://unpkg.com/vue/dist/vue.js&q ...

  2. Vue 中的Vue Router一级路由,二级路由,三级路由以及跳转

    今天编写了一下Vue中的路由 先用命令行新建一个空的项目,并且我知道要用路由,就下载了路由的相关依赖 vue init webpack demo5 完毕之后进入所在的项目 cd demo5 之后用vs ...

  3. Vue router 全局路由守卫

    记录一下全局路由守卫的使用: 方法一:定义一个数组用于检测与管理需要登录的页面,全局路由守卫配合本地存储判断是否跳转 import Vue from 'vue' import Router from ...

  4. vue router动态路由

    <div id="#app"> <router-link to="/user/header">路由1</router-link&g ...

  5. vue router引入路由与路由配置容易犯错的地方与常见的报错与处理报错

    首先npm安装vue-router插件,就不说了其次: 先看下我本地的目录结构吧 第一步:在src目录下新建一个专门存放router的index.js文件里面的内容为: import Vue from ...

  6. Vue router link

    html: <router-link to="test">Go to Foo</router-link> <router-link to=" ...

  7. [Vue 牛刀小试]:第十三章 - Vue Router 基础使用再探(命名路由、命名视图、路由传参)

    一.前言 在上一章的学习中,我们简单介绍了前端路由的概念,以及如何在 Vue 中通过使用 Vue Router 来实现我们的前端路由.但是在实际使用中,我们经常会遇到路由传参.或者一个页面是由多个组件 ...

  8. 前端MVC Vue2学习总结(八)——Vue Router路由、Vuex状态管理、Element-UI

    一.Vue Router路由 二.Vuex状态管理 三.Element-UI Element-UI是饿了么前端团队推出的一款基于Vue.js 2.0 的桌面端UI框架,手机端有对应框架是 Mint U ...

  9. react router @4 和 vue路由 详解(四)vue如何在路由里面定义一个子路由

    完整版:https://www.cnblogs.com/yangyangxxb/p/10066650.html 6.vue如何在路由里面定义一个子路由? 给父路由加一个 children:[] 参考我 ...

  10. Vue Router 路由守卫:完整的导航解析流程

    完整的导航解析流程 1 导航被触发. 2 在失活的组件里调用离开守卫. 3 调用全局的 beforeEach 守卫. 4 在重用的组件里调用 beforeRouteUpdate 守卫 (2.2+). ...

随机推荐

  1. zabbix 监控项报"Value "(No info could be read for "-p": geteuid()=1002 but you should be root"

    zabbix 监控项报错如下: “Value "(No info could be read for "-p": geteuid()=1002 but you shoul ...

  2. [IDA] 将变量索引进行计算

    按 k 键 [ebp+var+arg_0] - > [ebp+value]

  3. Razor 进度的变速

    视频录制了 .但发现 进度太慢了,对于当下市场 和我们的学习进度基本不会成正比关系了.所以,改一下 我们教程的实现方式. 我和大家 一起 看一下关联的技术的点, 提出我们要做的 内容 动手实践, 可能 ...

  4. ArchLinux 2019.11.01安装流程--安装基本系统

    安装前的一些话 本文是参考官方文档ArchLinux的Installation guide(简体中文)加实际操作编写的. 有啥都好说,转载时请注明作者,这是基本素质,也是法律要求 安装是在虚拟机上进行 ...

  5. cmd start命令启动文件的路径

    最近在脚本中通过WScript.Shell执行命令行,实现IE打开Chrome的功能. JS代码如下: var singleurl = window.location.href; var isChro ...

  6. Linux中raid磁盘阵列

    一.磁盘阵列(Redundant Arrays of Independent Disks,RAID) 有“独立磁盘构成的具有冗余能力的阵列”之意. 磁盘阵列是由很多价格较便宜的磁盘,以硬件(RAID卡 ...

  7. Autofac 应用于IIS托管的WEB程序,注册程序集被回收的问题

    现项目开始全面接入Autofac,但上线了后发现,iis进程被回收后,在访问网页提示找不到注册在Autofac中的类型,或者实例.现在处理办法记录如下: 1. IIS托管的应用程序,在首次加载时,所有 ...

  8. centos 下创建本地镜像源,结合 nginx

    1. 创建同步文件 参考清华的Centos源,配置同步文件.https://mirrors.tuna.tsinghua.edu.cn/help/centos/ [root@localhost cent ...

  9. 执行 npm cache clean报错

    C:\Users\you name>npm cache cleannpm ERR! As of npm@5, the npm cache self-heals from corruption i ...

  10. golang数据结构和算法之QueueLinkedList链表队列

    队列和堆栈不一样的地方在于进出顺序: 堆栈是后进先出, 队列是先进先出. QueueLinkedList.go package QueueLinkedList type Node struct { d ...