vue-router.mjs:3252 TypeError: Cannot use ‘in‘ operator to search for ‘validateStatus‘ in http://loc

简介: vue-router.mjs:3252 TypeError: Cannot use ‘in‘ operator to search for ‘validateStatus‘ in http://loc

今天在敲代码的时候,遇到了一个

vue-router.mjs:3252 TypeError: Cannot use 'in' operator to search for 'validateStatus' in http://localhost:9090 at mergeDirectKeys (mergeConfig.js:66:14) at computeConfigValue (mergeConfig.js:105:25) at Object.forEach (utils.js:258:10) at mergeConfig (mergeConfig.js:103:53) at Function.create (axios.js:62:91) at eval (request.js:3:1) at ./src/utils/request.js (src_views_testAdmin_vue.js:48:1) at __webpack_require__ (app.js:177:32) at fn (app.js:440:21) at eval (user.js:11:75)
 
vue-router.mjs:60 [Vue Router warn]: Unexpected error when starting the router: TypeError: Cannot use 'in' operator to search for 'validateStatus' in http://localhost:9090 at mergeDirectKeys (mergeConfig.js:66:14) at computeConfigValue (mergeConfig.js:105:25) at Object.forEach (utils.js:258:10) at mergeConfig (mergeConfig.js:103:53) at Function.create (axios.js:62:91) at eval (request.js:3:1) at ./src/utils/request.js (src_views_testAdmin_vue.js:48:1) at __webpack_require__ (app.js:177:32) at fn (app.js:440:21) at eval (user.js:11:75)

中文翻译

vue-router.mjs:3252类型错误:无法使用“in”运算符在http://localhost:9090的merge direct keys(merge config . js:66:14)处的computeConfigValue(merge config . js:105:25)处的object . foreach(utils . js:258:10)处的merge config(merge config . js:103:53)处的function . create 65/src/utils/request . js(src _ views _ test admin _ vue . js:48:1)at _ _ web pack _ require _ _(app . js:177:32)at fn(app . js:440:21)at eval(user . js:11:75) Vue-Router . mjs:60【Vue Router warn】:启动路由器时出现意外错误:类型错误:无法使用“in”运算符搜索http://localhost:9090中的merge direct keys(merge config . js:66:14)处的computeConfigValue(merge config . js:105:25)处的object . foreach(utils . js:258:10)处的merge config(merge config . js:103:53 65/src/utils/request . js(src _ views _ test admin _ vue . js:48:1)at _ _ web pack _ require _ _(app . js:177:32)at fn(app . js:440:21)at eval(user . js:11:75)

怎么解决,参考别人写的文章:

Vue 封装 axios 请求时的坑(Cannot use ‘in‘ operator to search for ‘validateStatus‘ in http://localhost:8080)-CSDN博客

将请求拦截器改成这样就可以了

import axios from "axios";
const baseURL = 'http://localhost:9090';
const instance = axios.create({
    baseURL:baseURL
});
instance.interceptors.response.use(
    result => {
        return result.data;
    },
    err => {
        alert('服务异常');
        return Promise.reject(err);
    }
)
// 导出axios自定义函数
export default instance
相关文章
|
SQL Linux
Cannot connect to discovery server for announce: Announcement failed for http://hadoop102:8881
linux下启动Presto报错:Cannot connect to discovery server for announce: Announcement failed for http://hadoop102:8881
Cannot connect to discovery server for announce: Announcement failed for http://hadoop102:8881
|
6月前
|
Java Maven
Cannot access repo1 (http://repo1.maven.org/maven2) in offline mode and the
Cannot access repo1 (http://repo1.maven.org/maven2) in offline mode and the
120 0
|
API 开发工具 git
解决 `remote: You must use a personal access token with 'api' scope for Git over HTTP.`
`git clone` 报错,解决 `remote: You must use a personal access token with 'api' scope for Git over HTTP.`
497 0
解决 `remote: You must use a personal access token with 'api' scope for Git over HTTP.`
|
存储 NoSQL Java
java.lang.IllegalStateException: Cannot load configuration class: org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration
java.lang.IllegalStateException: Cannot load configuration class: org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration报错问题处理
java.lang.IllegalStateException: Cannot load configuration class: org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration
【node报错解决方案】Error: Cannot find module http-errors
【node报错解决方案】Error: Cannot find module http-errors
496 0
【node报错解决方案】Error: Cannot find module http-errors
|
XML Java 应用服务中间件
怒赞!The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml解决方案
怒赞!The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml解决方案
99 0
怒赞!The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml解决方案
|
Java
SpringBoot报错:端口被占用Address already in use(Failed to start component [Connector[HTTP/1.1-8080)
SpringBoot报错:端口被占用Address already in use(Failed to start component [Connector[HTTP/1.1-8080)
406 0
SpringBoot报错:端口被占用Address already in use(Failed to start component [Connector[HTTP/1.1-8080)
|
Java 应用服务中间件 Apache
Eclipse中出现The type javax.servlet.http.HttpServletRequest cannot be resolved问题
Eclipse中出现The type javax.servlet.http.HttpServletRequest cannot be resolved问题
436 0
Eclipse中出现The type javax.servlet.http.HttpServletRequest cannot be resolved问题
Method search not annotated with HTTP method type (ex. GET, POST)
Method search not annotated with HTTP method type (ex. GET, POST)
956 0
|
Apache
解决办法:Cannot find the class file for org.apache.http.client.ClientProtocolException
解决办法:Cannot find the class file for org.apache.http.client.ClientProtocolException
376 0

热门文章

最新文章