学习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})
做何解?
9 回答1.7k 阅读✓ 已解决
6 回答1k 阅读
3 回答1.4k 阅读✓ 已解决
4 回答986 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
3 回答890 阅读
3 回答1.3k 阅读✓ 已解决
对象展开运算符。
当然你也可以选择使用
Object.assign
来替代。