知识点:vue路由传递参数,第二个页面(A.B页面)拿到参数,使用参数

方法一:使用 <router-link :to="{name:'edithospital',params:{hid:101}}">编辑</router-link>

1.在路由配置中添加

{
      name:'edithospital',             \\路由的名字
      path: '/edithospital/:hid',      \\路由中添加要传递的参数:hid
      component: resolve => require(['../components/page/hospital/EditHospital.vue'], resolve)
}

. A页面

<router-link :to="{name:'edithospital',params:{hid:101}}">编辑</router-link> \\101是变量,可根据实际情况改变

\\name是路由的名字,params是传递的参数

3. B页面 <template><template>中添加

{{$route.params.hid}}     // 101

方法二:<button @click="handleEdit(scope.$index, scope.row)"> 编辑</button>

1.同上

2.A页面

handleEdit(index, row) {
this.$router.push({
name: 'edithospital',
params: {
hid: row.hid //row.hid为变量
}
})
}, 3.同上
--------------------------------------------------------------------------------------------------------------------------------------
效果参考:
可参考:1.https://segmentfault.com/q/1010000009749320
2.http://blog.csdn.net/wy01272454/article/details/77869442?locationNum=7&fps=1

最新文章

  1. Android开发之Activity横竖屏切换生命周期重建问题
  2. ios CoreData NSManagedObject 生命周期
  3. Tomcat7 安装StartSSL证书笔记
  4. drupal里面的ajax最粗浅的理解-流程
  5. Yii 框架ajax搜索分页
  6. [Webpack 2] Grouping vendor files with the Webpack CommonsChunkPlugin
  7. Self-numbers 2 - SGU 108
  8. QDomDocument类
  9. 认识&lt;hr&gt;标签,添加水平横线
  10. iOS 准备
  11. Springmvc+Spring+Mybatis实现员工登录注册功能
  12. RedHat升级Python到2.7.6
  13. BZOJ 3123: [Sdoi2013]森林 [主席树启发式合并]
  14. Ubuntu 18.04 启动root账号并授权远程登录
  15. 【问题解决方案】AttributeError: module &#39;pygal&#39; has no attribute &#39;Worldmap&#39;
  16. 【Python 02】计算机与程序设计
  17. Python之进度条及π的计算
  18. fastjson序列化乱序问题
  19. js 在线引用
  20. Java 虚拟机 最易理解的 全面解析

热门文章

  1. mysql主从同步出现异常语句跳过错误处理
  2. Gunner II--hdu5233(map&amp;vector/二分)
  3. wait_event族函数浅析
  4. HTTP request is unauthorized with client authentication scheme &#39;Anonymous&#39;. The authentication header received from the server was &#39;NTLM&#39;。
  5. git本地与远程分支
  6. centos7配置IP地址
  7. 读取xml文件,写入excel
  8. PHP魔术方法和魔术常量介绍及使用
  9. UVA+POJ中大数实现的题目,持续更新(JAVA实现)
  10. docker——安装