網站首頁 編程語言 正文
axios-GET請求
created() { console.log('該組件要被加載成功了') this.$axios({ url: "http://127.0.0.1:8080/student/3", method: "GET", headers: { // 'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'multipart/form-data' } }).then(response => { console.log(response) } ).catch(error => { console.log(456) console.log(error) } );
Gin-GET響應
r.GET("/student/:ID", func(c *gin.Context) { id := c.Param("ID") var student Student _ = c.ShouldBind(&student) db.Preload("Teachers").Preload("IDCard").First(&student, "id=?", id) c.JSON(200, gin.H{ "msg": student, }) })
Vue-POST請求
this.$axios({ url: "http://127.0.0.1:8080/test", method: "post", headers: { 'Content-Type':'application/x-www-form-urlencoded', }, data: { "name": "jeff", "age": 18 } }).then(response => { console.log(response) } ).catch(error => { console.log(456) console.log(error) } );
Gin-POST響應
r.POST("/test", func(c *gin.Context) { user := c.PostForm("name") pwd := c.PostForm("age") fmt.Println(user) fmt.Println(pwd) fmt.Println(c) c.JSON(200, gin.H{ "msg": "成功!", }) })
原文鏈接:https://www.cnblogs.com/guyouyin123/p/14169363.html
- 上一篇:Python文件的壓縮與解壓_python
- 下一篇:C#實現歸并排序_C#教程
相關推薦
- 2023-01-26 Android原生集成RN最新版教程_Android
- 2022-10-02 react+typescript中使用echarts的實現步驟_React
- 2022-05-20 Kafka 認證登錄注意事項
- 2023-02-01 Python動態演示旋轉矩陣的作用詳解_python
- 2022-12-23 C++?Boost?Parameter超詳細講解_C 語言
- 2022-05-27 C++?超詳細快速掌握二叉搜索樹_C 語言
- 2022-04-04 微信登陸失敗Error: invalid code
- 2022-01-30 axios自帶的上傳進度回調函數
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支