在vue.app里创建一个mounted生命函数,在methods里写入一个方法:
mounted(){
this.beforeCreate()
},
methods:{
beforeCreate () { // 浏览器刷新之后回到登录页面
if (this.$router.path !== '/') {
this.$router.replace('/about')
}
}
}
在vue.app里创建一个mounted生命函数,在methods里写入一个方法:
mounted(){
this.beforeCreate()
},
methods:{
beforeCreate () { // 浏览器刷新之后回到登录页面
if (this.$router.path !== '/') {
this.$router.replace('/about')
}
}
}