这是后端代码
@PostMapping("/apk/selectAllApk")
@ResponseBody
public R selectAllApk(@RequestBody(required = false) Apk apk) {
R r = new R();
List<Apk> apks = apkFeign.selectAllList(apk);
return r.ok(apks);
}
前端代码
<script th:inline="none">
layui.use('table', function () {
var table = layui.table;
table.render({
elem: '#table'
, height: 312
, contentType: 'application/json'//添加这句话
, method: 'POST'
, url: '/apk/selectAllApk' //数据接口
, cols: [
[
{field: 'id', width: 80, title: 'ID', sort: true}
, {field: 'name', width: 80, title: '用户名'}
, {field: 'size', width: 80, title: '性别', sort: true}
, {field: 'apkUrl', width: 80, title: '城市'}
, {field: 'packageName', title: '签名', width: '30%', minWidth: 100}
, {field: 'apkMd5', title: '积分', sort: true}
, {field: 'apkVersion', title: '评分', sort: true}
, {field: 'createdTime', title: '职业'}
, {field: 'updatedTime', width: 137, title: '财富', sort: true}
]
]
});
});
报错信息
服务端发生异常
org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported