日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無先后,達(dá)者為師

網(wǎng)站首頁 編程語言 正文

前端傳遞對象數(shù)組,后端使用list接收并解析

作者:前端開心果 更新時(shí)間: 2023-08-01 編程語言

使用環(huán)境:前端 vue + axios,后端 springBoot
前端

save() {
    const data = [] // 圖片對象數(shù)組
    data.push({
        gpGid: this.gId,
        gpAddress: this.imgList[0],
        gpIsCover: 1,
    })
    this.$axios({
        url: 'goodsPicture/save',
        method: 'post',
        dataType: 'json',
        data: JSON.stringify(data),
        headers: {
            'Content-Type': 'application/json',
        },
    }).then(res => {
        if (res.data.code === 200) {
            console.log(res.data)
        }
    })
    .catch(error => {
        console.log(error)
    })
}

后端

@PostMapping(value = "/save")
@RequiresRoles("business")
public MyResult save(@RequestBody List<GoodsPicture> goodsPictureList) {
    System.out.println("我進(jìn)來了");
}

原文鏈接:https://blog.csdn.net/qq_38157825/article/details/105291362

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新