-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
加入了一个注册路由,使用router-link,只有登录后才能正常跳转,怎样才能使其未登录状态下也能跳转到注册页面 #3
Comments
因为我没有做注册页面,所以就没考虑注册页面的问题,刚刚看了下,你在permission里面稍微修改下,先判断isLogin,添加else判断to.path是否在默认不需要登录的里面,具体代码如下,我就不提交记录了。 router.beforeEach(async (to, from, next) => {
} else { |
大佬你好,我在打包关闭mock后 更改登录的接口名,但其访问的url后仍然带着mock . |
你是访问后还带着mock的数据还是/mock前缀,前缀的话就去env里面修改VUE_APP_BASE_API 为你自己的,不要mock数据的话你去vue.config.js只去掉before那行,然后去main.js去掉引入mock的,如果存在跨域的问题,你就配置下vue.config.js配置下proxy |
好的,谢谢。我已经将env.production中的UE_APP_BASE_API 配置为http**:7090 ,现在我访问的url中没有出现/mock,但是我其请求一直在pedding且登录按钮的uploading一直为true。备注:我将后台登录后返回的结果中的某一字段设置为token(后台基于cookies,然后将request中interceptors注释掉了) |
1 similar comment
好的,谢谢。我已经将env.production中的UE_APP_BASE_API 配置为http**:7090 ,现在我访问的url中没有出现/mock,但是我其请求一直在pedding且登录按钮的uploading一直为true。备注:我将后台登录后返回的结果中的某一字段设置为token(后台基于cookies,然后将request中interceptors注释掉了) |
VUE_APP_BASE_API这个是设置前缀的,如'/api' 如果你要请求你本地的 接口的话,就去vue.config.js配置proxy |
export const baseRoute = [
{
name: 'login',
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
name: 'register',
path: '/register',
component: () => import('@/views/register/index'),
hidden: true
}]
The text was updated successfully, but these errors were encountered: