GVA gin vue从后端接口获取多选下拉框数据
生活随笔
收集整理的這篇文章主要介紹了
GVA gin vue从后端接口获取多选下拉框数据
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
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] = mapAoptions[1] = mapBc.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},總結
以上是生活随笔為你收集整理的GVA gin vue从后端接口获取多选下拉框数据的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vuex状态管理模式:入门demo(状态
- 下一篇: vue指令:v-pre原样输出,不解析插