当前位置:网站首页>router---路由守卫
router---路由守卫
2022-08-04 12:59:00 【monstkl】
一、守卫参数
1、to 将要进入的路由
2、from 当前导航正要离开的路由
3、next 表示放行,在使用必须严格保证该方法起码被调用一次,极容易出现死循环的现象
next方法的参数可以是路径字符串,也可以是对象
路径字符串:
routes:[{path: '/test'}]
next('test') 或者 next('/test') 都可以
对象:
next({name: 'detail'})
next({path: '/detail'})
常见场景:
替换当前路由如下操作---
beforeEach (to, from, next) {
if (to.name === 'detail') {
next()
next({...to, replace: true})
}
}
二、全局守卫
三、路由独享守卫
四、组件内守卫
五、导航解析流程
边栏推荐
猜你喜欢

七夕疯狂搞钱的年轻人,一周赚14万

使用COLMAP初步三维重建
![Valentine's Day Romantic 3D Photo Wall [with source code]](/img/a9/2c26f4f048f3c0a9a65551bc734233.png)
Valentine's Day Romantic 3D Photo Wall [with source code]

持续交付(二)PipeLine基本使用

双目立体视觉学习笔记(一)

A comprehensive understanding of MOS tubes, an article is enough

leetcode 48. Rotate Image 旋转图像(Medium)

Ceres库运行,模板内报内存冲突问题。(已解决)

新 Nsight Graph、Nsight Aftermath 版本中的性能提升和增强功能

手搓一个“七夕限定”,用3D Engine 5分钟实现烟花绽放效果
随机推荐
年轻人为什么不喜欢买蒙牛、伊利了?
Programmer Qixi Gift - How to quickly build an exclusive chat room for your girlfriend in 30 minutes
用过Apifox这个API接口工具后,确实感觉postman有点鸡肋......
Script to get local IP address
持续交付(三)Jenkinsfile语法使用介绍
Django使用腾讯云发送短信并存入redis
到底什么是真正的HTAP?
并发刺客(False Sharing)——并发程序的隐藏杀手
SCA兼容性分析工具(ORACLE/MySQL/DB2--->MogDB/openGauss/PostgreSQL)
Django框架MySQL数据库到models模型的映射关系
LeetCode_424_替换后的最长重复字符
企业应当实施的5个云安全管理策略
面试官:连 INSERT INTO SET 都不知道怎么用,你这3年都干些什么了?
论文翻译:2022_Time-Frequency Attention for Monaural Speech Enhancement
Hit the interview!The latest interview booklet of Ali Jin, nine silver and ten is stable!
js正则表达式提取内容
两个数组中用第二个数组的Value对比换第一个数组中的Key
leetcode 48. Rotate Image 旋转图像(Medium)
他是“中台”之父,凭一个概念为阿里狂赚百亿
鲜花“刺客”收割七夕