1:查看router-view所对应的位置,是属于顶级出口还是存在于某个组件当中

2:当router-view存在于某个组件当中时

const User = {
template: `
<div class="user">
<h2>User {{ $route.params.id }}</h2>
<router-view></router-view>
</div>
`
}

  那么我们在路由文件中,定义对应user的路由当中,需要添加子路由形式

const router = new VueRouter({
routes: [
{ path: '/user/:id', component: User,
children: [
{
// 当 /user/:id/profile 匹配成功,
// UserProfile 会被渲染在 User 的 <router-view> 中
path: 'profile',
component: UserProfile
},
{
// 当 /user/:id/posts 匹配成功
// UserPosts 会被渲染在 User 的 <router-view> 中
path: 'posts',
component: UserPosts
},
// 当 /user/:id 匹配成功,
// UserHome 会被渲染在 User 的 <router-view> 中
{ path: '', component: UserHome },
]
}
]
})

** 以'/'开头的嵌套路径会被当作根路径,合理的模式是给每个级别的路由都添加空的子路由

最新文章

  1. SharePoint 2010 数据库xxx的事务日志已满
  2. diff生成补丁与patch打补丁
  3. ReStart
  4. 数论 - 简单数位推理 --- NYIST 514
  5. JavaScriptSerializer中日期序列化问题解决方案
  6. 【转】Profiling application LLC cache misses under Linux using Perf Events
  7. AOD.net
  8. MySQL数据库获取汉字拼音的首字母函数
  9. linux处置服务Iptables
  10. kubernetes1.4 基础篇:Learn Kubernetes 1.4 by 6 steps
  11. python实现的txt目录树
  12. .Net中的并行编程-7.基于BlockingCollection实现高性能异步队列
  13. zabbix误报交换机重启
  14. Android屏幕亮度调节相关源码
  15. MVC 5 调用存储过程参数配置方法-Procedure or function &#39;UP_***&#39; expects parameter &#39;@****&#39;, which was not supplied.
  16. Spring Boot + Spring Cloud 实现权限管理系统 后端篇(二十一):服务网关(Zuul)
  17. poi excel 设置边框字体行高行宽
  18. 【转】CSRF基本概念
  19. 【转】UML类图符号 6种关系说明以及举例
  20. Linux操作_磁盘管理_增加虚拟磁盘

热门文章

  1. vue md5
  2. ArcGis dbf读写——挂接Excel到属性表 C#
  3. Ext.net MessageBox提示
  4. [Machine Learning] 浅谈LR算法的Cost Function
  5. string与number转换
  6. MVC实例应用模式
  7. tomcat 8.0安装ssl证书,及centos7.2 的openssl升级到最新版本,及ERR_SSL_OBSOLETE_CIPHER错误解决
  8. ps切图技巧
  9. 转:Spring历史版本变迁和如今的生态帝国
  10. Mysql 时间差(年、月、天、时、分、秒)