问题描述
我现在使用sessionStorage存的路由表,在页面刷新后,动态添加路由表就报错了
//
created(){
if(sessionStorage.getItem('user')){
var localRoutes=sessionStorage.getItem('routes')
console.log(localRoutes)
console.log(this.$router)
//使用这个方法添加动态路由报错
this.$router.addRoutes(JSON.parse(localRoutes))
}
}
报错如下
Vue warn: Error in beforeCreate hook: "TypeError: Cannot read property 'call' of null",
这个是怎么回事尼?
该怎么解决
看下是不是beforeCreate钩子里面使用了xx.call,而xx还没被创建