Skip to content
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

在axios中使用router跳转报错 #367

Closed
jiaicon opened this issue Nov 24, 2023 · 5 comments
Closed

在axios中使用router跳转报错 #367

jiaicon opened this issue Nov 24, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@jiaicon
Copy link

jiaicon commented Nov 24, 2023

我在config/axios/config.ts中配置响应拦截器,使用router跳转,pnpm dev启动时报大量错误,下面截图是我更改的代码
image
image
image

@caicf
Copy link

caicf commented Nov 28, 2023

可以再store里或者封装到util里处理

@jiaicon
Copy link
Author

jiaicon commented Nov 29, 2023

可以再store里或者封装到util里处理

也不行,只要调用了router控制台就会出现错误,这个是什么原因造成的?刚用Vue没多久,希望能解答下。

@kailong321200875 kailong321200875 added help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Nov 29, 2023
@kailong321200875
Copy link
Owner

是会有这种问题,目前不懂是因为什么引起的,有待排查

@kailong321200875 kailong321200875 added the bug Something isn't working label Nov 29, 2023
@kailong321200875
Copy link
Owner

kailong321200875 commented Nov 29, 2023

可以再store里或者封装到util里处理

也不行,只要调用了router控制台就会出现错误,这个是什么原因造成的?刚用Vue没多久,希望能解答下。

初步判定,是因为mock插件引起的,如果项目中已经不需要用到mock了,可以把相关代码和文件删除掉看看 @jiaicon

@jiaicon
Copy link
Author

jiaicon commented Nov 29, 2023

可以再store里或者封装到util里处理

也不行,只要调用了router控制台就会出现错误,这个是什么原因造成的?刚用Vue没多久,希望能解答下。

初步判定,是因为mock插件引起的,如果项目中已经不需要用到mock了,可以把相关代码和文件删除掉看看 @jiaicon

好的,去掉确实不报错了
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants