学习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})
做何解?
4 回答4.6k 阅读✓ 已解决
4 回答2.1k 阅读✓ 已解决
4 回答2.2k 阅读✓ 已解决
3 回答5.1k 阅读
2 回答2.6k 阅读✓ 已解决
1 回答3.1k 阅读✓ 已解决
2 回答1.5k 阅读✓ 已解决
对象展开运算符。
当然你也可以选择使用
Object.assign
来替代。