1.使用router-link 不会让页面刷新,使用a标签会使页面刷新。
2.router-link 里面的to="/路由地址" tag=""自定义标签" 默认为a标签,linkActiveClass 可以更改默认类名。
3.在 HTML5 history 模式下,router-link 会拦截点击事件,让浏览器不在重新加载页面。
4.当你在 HTML5 history 模式下使用 base 选项之后,所有的 to 属性都不需要写(基路径)了。
5.传参:
<router-link :to="{ path: 'register', query: { userId: 'xxx' }}">Register</router-link>
<router-link :to="{ name: 'user', params: { userId: 123 }}">User</router-link>
6.二级路由和多级路由配置就在当前路由下面配置children:[{path:"xxxx",name:"xxx",component:xxx}]
7.路由全局守卫(路由钩子函数)
router.beforeEach((to,from,next)=>{
    console.log("跳转前")
   //判断stroe.getter.isLogin ==== false
   // if(to.path=="/login" || to.path == "/register"){
   next();
    // }else{
          next("/login")
   // }
})
8.路由后置钩子函数
router.afterEach((to,from)=>{
     console.log("跳转后")
})

9.路由独享守卫:
就是在配置路由界面加上
router.beforeEach((to,from,next)=>{
    console.log("跳转前")
})

10.组件内守卫
进入时候
beforeRouterEnter:(to,from,next)=>{
next(vm=>{
     alert("vm.name")
})
离开时候
beforeRouterEnter:(to,from,next)=>{
    if(confirm("确定要离开么?") == true){
         next()
    }else{
        next(false)
   }
}

最新文章

  1. 在64位系统上不能安装Matlab notebook的解决方案
  2. VSFTPD配置TLS/SSL
  3. tomcat异常: Cannot get a connection, pool exhausted
  4. 常见行为:仿真&amp;重力&amp;碰撞&amp;捕捉
  5. C#.net 获取当前应用程序所在路径及环境变量
  6. hdu 4447 Yuanfang, What Do You Think?
  7. HttpServletRequest 的使用
  8. ZOJ 2283 Challenge of Wisdom
  9. 【设计模式:单例模式】使用单例模式加载properties文件
  10. 如何获取fragment里的控件
  11. CSS---input标签注意
  12. Web监听器导图详解(转)
  13. Educational Codeforces Round 22.B 暴力
  14. word文档转pdf,支持.doc和.docx,另附抽取pdf指定页数的方法
  15. ip访问网站和localhost访问网站中top使用
  16. cornerstone 使用-图标含义-分支-合并
  17. .yml文件格式
  18. path-control demo js
  19. 计算MySQL的内存峰值公式 (转)
  20. 关于supervisor无法监控golang代码的解决方法

热门文章

  1. 契约式设计 契约式编程 Design by contract
  2. 清空sql 日志
  3. How to Execute Page_Load() in Page&#39;s Base Class?
  4. 从sp_executesql中返回table型数据及动态SQL语句的参数化查询
  5. Linux共享内存(二)
  6. python标准输入,标准输出,标准错误
  7. C++中continue
  8. 清除当前文件夹下.svn文件的方法
  9. 微信公众平台——基础配置——服务器配置:PHP版
  10. E20180219-hm-xa