GVA gin vue从后端接口获取多选下拉框数据
2023-09-14 09:01:54 时间
gin代码
func (studentApi *StudentApi) GetStuHobbies(c *gin.Context) {
options := make([]map[string]string, 2)
mapA := make(map[string]string)
mapA["value"] = "选项1"
mapA["label"] = "黄金糕"
mapB := make(map[string]string)
mapB["value"] = "选项2"
mapB["label"] = "双皮奶"
options[0] = mapA
options[1] = mapB
c.JSON(0, gin.H{
"msg": "获取成功",
"options": options,
})
}
vue
export const getStuHobbies = (params) => {
return service({
url: '/student/getStuHobbies',
method: 'get',
params
})
}
===========================================================================
async created() {
await this.getTableData()
await this.getDict('sex')
this.fillOptions()
},
methods: {
async fillOptions(){
const resp=await getStuHobbies()
console.log(">>>>>>>>>>>>",resp)
this.options=resp.options
},
相关文章
- vue+php接口
- vue.js3: 用axios访问接口(vue@3.2.37 / axios@0.27.2)
- vue_axios请求封装、异常拦截统一处理
- 部署vue.js3.x项目到线上(vue.js 3.2.6/nginx 1.18.0)
- nginx配置部署vuejs gva(gin-vue-admin)项目并解决后端api接口请求时报404问题(附nginx.conf)
- Atitit mvc之道 attilax著 以vue为例 1. Atitti vue的几大概念1 1.1. 声明式渲染1 1.2. 条件与循环2 1.3. 处理用户输入 click事件2 1
- 移动端h5网页、微信网页调试之利用vConsole真机调试+显示控制台打印信息、调试接口(附带vue项目里的具体使用方法)
- Vue 多个路由文件的合并
- vue脚手架搭建报错:vue-cli · Failed to download repo vuejs-templates/webpack: connect ETIMEDOU
- ASP.NET Core微服务(四)——【静态vue使用axios解析接口】
- 看大神如何使用vue导出pdf
- 计算机毕设 SSM Vue的勤工助学管理系统(含源码+论文)
- 在vue中的form表单中下拉框中的数据来自数据库查询到的数据
- vue-cli生成的项目配置开发和生产环境不同的接口
- 前端MVC Vue2学习总结(八)——Vue Router路由、Vuex状态管理、Element-UI
- Vue实战狗尾草博客后台管理系统第七章
- vue-router(一)
- 217:vue+openlayers上传GPX文件,导出geojson文件
- 094:vue+openlayers根据zoom的不同,显示不同的地图
- 035:vue+openlayers上传GeoJSON文件并解析(代码示例)
- vue中Axios的封装和API接口的管理
- 基于Java+SpringBoot+SpringCloud+Vue前后端分离医院管理系统设计与实现