(property) _RouteLocationBase.name: RouteRecordName | null | undefined
Name of the matched record
类型“RouteRecordName | null | undefined”的参数不能赋给类型“string”的参数。
不能将类型“undefined”分配给类型“string”。ts(2345)
代码是这样的:
const allowList = ['login', 'register', 'registerResult'] // no redirect allowList
router.beforeEach((to, from, next) => {
NProgress.start(); // NProgress 开始
setDocumentTitle('1111') // 动态设置页面的标题
console.log(allowList.includes(to.name))
})
请问这样写?
Name of the matched record
类型“RouteRecordName | null | undefined”的参数不能赋给类型“string”的参数。
不能将类型“undefined”分配给类型“string”。ts(2345)
代码是这样的:
const allowList = ['login', 'register', 'registerResult'] // no redirect allowList
router.beforeEach((to, from, next) => {
NProgress.start(); // NProgress 开始
setDocumentTitle('1111') // 动态设置页面的标题
console.log(allowList.includes(to.name))
})
请问这样写?