欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Vue axios请求接口状态返回200,但报错We‘re sorry but (项目名称) doesn‘t work properly without JavaScript enabled.

程序员文章站 2022-03-08 15:31:28
问题vue项目本地调试时,用axios请求接口,接口返回200成功状态码,但是返回提示信息We’re sorry but (项目名称) doesn’t work properly without JavaScript enabled.解决办法查看请求接口地址看是不是前面少了前缀或者斜杠例如我的这是错误的请求,这样就会报We’re sorry but [项目名称] doesn’t work properly without JavaScript enabled. Please enable it...

问题

vue项目本地调试时,用axios请求接口,接口返回200成功状态码,但是返回提示信息We’re sorry but (项目名称) doesn’t work properly without JavaScript enabled.

解决办法

查看请求接口地址看是不是前面少了前缀或者斜杠,例如我的
Vue axios请求接口状态返回200,但报错We‘re sorry but (项目名称) doesn‘t work properly without JavaScript enabled.
Vue axios请求接口状态返回200,但报错We‘re sorry but (项目名称) doesn‘t work properly without JavaScript enabled.
这是错误的请求,这样就会报We’re sorry but [项目名称] doesn’t work properly without JavaScript enabled. Please enable it to continue.的错误,然后去修改请求地址,加上斜杆,请求地址就由http://localhost:8024/apiproduct/list变成了http://localhost:8024/api/product/list,这样请求成功能够获取到数据了,这是一种情况

另外一种就是没有加请求前缀的,例如请求地址是http://localhost:8024/product/list,那么也一样的请求不成功,因为缺少了/api的请求前缀,当然这是我这个接口有这个前缀。

其实发生这种错误,在排除服务器的配置以及本地路由配置问题后,就是自己写请求接口地址的时候写错了

本文地址:https://blog.csdn.net/qq_40225369/article/details/112799161

相关标签: axios vue