学习VUE3,在看到一些源码中,内容如下:
router.beforeEach(async (to, from, next) => {
if (to.path === '/login') {
next()
} else {
//...... 一些处理
next({ ...to, replace: true })
}
}
其中 next({...to,replace:true})
做何解?
学习VUE3,在看到一些源码中,内容如下:
router.beforeEach(async (to, from, next) => {
if (to.path === '/login') {
next()
} else {
//...... 一些处理
next({ ...to, replace: true })
}
}
其中 next({...to,replace:true})
做何解?
5 回答4.8k 阅读✓ 已解决
4 回答3k 阅读✓ 已解决
2 回答4.7k 阅读✓ 已解决
4 回答4.3k 阅读✓ 已解决
4 回答1.8k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
2 回答2.5k 阅读✓ 已解决
对象展开运算符。
当然你也可以选择使用
Object.assign
来替代。