局部导航守卫的使用

beforeRouteEnter(to,from,next){
        /*判断from导航字符串中是否以stglist结尾
         * 如果不是从stglist进入当前导航,重新导航到stglist
         */
        if(from.path.endsWith('stglist')){
            next()
        }else{
            next({
                path:'/createstg/stglist'
            })
        }
        
    }

猜你喜欢

转载自blog.csdn.net/aliven1/article/details/81392505