在Controller层接收axios.get()请求的参数时候,不论是发送单个参数,或者json类型、map类型参数,不论后台用@RequestParam、@RequestBody 、@PathVariable (请求路径上加不加占位符都尝试了)都接收不到。
最后发现发送的参数要加params:{ } ,请求路径上不加任何注解,这样可以接收到。
后台代码
@Controller
@RequestMapping("cart")
@ResponseBody
public class CartController {
@Autowired
private CartServiceInterface cartServiceInterface;
@Autowired
private GoodsServiceInterface goodsServiceInterface;
@RequestMapping("/add")
public R addCart(@RequestBody Cart cart) {
cartServiceInterface.save(cart);
return R.success(cart.getGoodsName() + "已添加购物车");
}
@RequestMapping("/get")
public R



