该错误表示请求失败并且返回状态码为404。可能原因是请求的URL不正确或者服务器上没有该资源。

解决方法:

1.检查请求的URL是否正确。

2.检查服务器上是否有该资源。

3.如果是跨域请求,需要在服务器端设置允许跨域。

4.在vue项目中可以使用axios的拦截器来处理请求错误。

例如:

import axios from 'axios'

axios.interceptors.response.use(response => {
  return response
}, error => {
  if (error.response.status === 404) {
    console.log('请求的资源不存在')
  }
  return Promise.reject(error)
})

该拦截器可以在请求出错时捕获错误并处理。当返回的状态码为404时,会打印出"请求的资源不存在"。

在vue中该如何解决settlejsf7bf19 Uncaught in promise AxiosError message Request failed with status code 404 name AxiosError code ERR_BAD_REQUEST config … request XMLHttpRequest …code ERR_BAD_REQUESTconfig tra

原文地址: http://www.cveoy.top/t/topic/fEeq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录