首页 > 其他分享 >axios无法加载响应数据:no data found for resource with given identifier

axios无法加载响应数据:no data found for resource with given identifier

时间:2024-05-13 09:20:46浏览次数:14  
标签:given axios resource 跨域 no data

做一个demo,springboot写好了接口,postman请求也没问题,如下:

但是axios请求时,却发生了问题:

查了一圈,没发现啥问题,又想起来看下控制台信息

跨域的问题?网上也有这么说的,抱着试试的态度在controller上增加了跨域的注解@CrossOrigin

重新运行,页面刷新,ok~

标签:given,axios,resource,跨域,no,data
From: https://www.cnblogs.com/zjfblog/p/18188590

相关文章

  • Useful resources
    AboutwritingMathematicalReasoningWritingandProof,formore,clickhere.Sciencewritingfornon-nativeEnglishspeakersMathematicalTypesettingResourcesMathematicalTypesettingResourcesonlinemarkdowneditorLecturenotesAlgebraHatcher......
  • Vue项目中有封装过axios吗?主要是封装哪方面的?
    一、axios是什么axios 是一个轻量的 HTTP客户端基于 XMLHttpRequest 服务来执行 HTTP 请求,支持丰富的配置,支持 Promise,支持浏览器端和 Node.js 端。自Vue2.0起,尤大宣布取消对 vue-resource 的官方推荐,转而推荐 axios。现在 axios 已经成为大部分 Vue 开发者的......
  • SpringBoot读取Resources下的文件
    packagecom.qzsl.dp.utils;importorg.springframework.beans.factory.annotation.Qualifier;importorg.springframework.core.io.Resource;importorg.springframework.core.io.ResourceLoader;importorg.springframework.stereotype.Component;importorg.springfr......
  • WPF dynamic resources drawbacks
     Dynamic resource, on the other hand, will create a temporary expression during the initial compilation and thus defer lookup for resources until the requested resource value is actually required in order to construct an obj......
  • Java-读取resource目录下的文件并返回给前端
    我在项目的resource目录下面放了一个模板文件,用来供用户下载提供一个接口给前端,用来下载在Utils类下面写个方法来读取代码publicstaticvoidgetXMindTemplate(HttpServletResponseresponse){StringfileName="templates/TestCaseTemplate.xmind";//文件名称ClassPa......
  • https://github.com/long36708/long36708/blob/main/resources/img/grid-snake.svg 请
    对于这个文件,你可以将它放在你的GitHub仓库的"resources"目录下,通常也可以选择"assets"、"images"或者其他类似的名称。如果你还没有这样的目录,你可以按照以下步骤操作:在你的GitHub仓库中创建一个新的目录,可以命名为"resources"、"assets"、"images"或者其他你喜欢......
  • 09-初始setup-axios-promise
    监听属性需要使用ref和ractive包一下才可以正常监听。//使用相关属性需要导入import{reactive,ref,watch}from"vue";//监听单个letname=ref("阿珂")watch(name,(newValue,oldValue)=>{console.log("老名字",oldValue);console.log("新名字"......
  • LeetCode 2060. Check if an Original String Exists Given Two Encoded Strings
    原题链接在这里:https://leetcode.com/problems/check-if-an-original-string-exists-given-two-encoded-strings/description/题目:Anoriginalstring,consistingoflowercaseEnglishletters,canbeencodedbythefollowingsteps:Arbitrarily split itintoa sequ......
  • Axios-POST 请求
    Axios是一个基于 promise 网络请求库,作用于node.js 和浏览器中。它是 isomorphic 的(即同一套代码可以运行在浏览器和node.js中)。在服务端它使用原生node.js http 模块,而在客户端(浏览端)则使用XMLHttpRequests。发起一个 POST 请求axios.post('/user',{......
  • axios 拦截器实现原理
    Axios拦截器是Axios提供的一种强大功能,允许你在请求发送到服务器之前或响应返回客户端之前对其进行修改或处理。拦截器主要有两种:请求拦截器(requestinterceptors)和响应拦截器(responseinterceptors)。实现原理拦截器数组:Axios内部维护了两个数组,一个用于存储请求拦截器,另......