get请求报错Error in v-on handler (Promise/async): "Error: Request failed with status code 400"

可能是参数错误
get请求在路径拼接参数分两种类型

一种是“/”类型拼接

在这里插入图片描述

            const {data: res} = await this.$http.get("/packagemanager/package/selecttwo/" + JSON.parse(window.sessionStorage.getItem("user")).uphone)

后端接受
在这里插入图片描述

 @RequestMapping(value = "/branch/{badress}", method = RequestMethod.GET)
    public Result findBranchByAddress2(@PathVariable("badress") String baddress) {

第二种是“?”后拼接

前端

const {data: res} = await this.$http.get("/backstage/branch/getlatitude", {params:item})

后端接受

 //查询某个地址的经纬度
    @RequestMapping(value = "/branch/getlatitude", method = RequestMethod.GET)
    public Result getlatitude(@RequestParam(value = "baddress") String baddress,
                              @RequestParam(value = "bdetialaddress")String bdetialadress) {

你可能感兴趣的:(报错整理)