解决Cannot read properties of null (reading ‘code‘)
在请求菜单页面时,会弹出一个请求不到菜单接口,当时的代码是:
@RequestMapping(value = "get/tree",method = {RequestMethod.GET,RequestMethod.POST})@ApiOperation(tags = "菜单管理左侧菜单树链接",value = "获取菜单树")public DtreeResult getTree(){DtreeResult result = new DtreeResult();
// 同dtree中status一样设置
// -------------此处出错-------------------------------------HashMap<Object, Object> map = new HashMap<>();map.put("code",200);map.put("message","操作成功");result.setStatus(map);
// 同dtree中data一样设置List<TreeNode> nodeList=menuService.getTreeNode();result.setData(nodeList);return result;}
之后看了一下代码,发现map返回的是一个map集合,并且里面的参数有误,应该改成:
Map<String,Object> map=new HashMap<>();
完整代码:
@RequestMapping(value = "get/tree",method = {RequestMethod.GET,RequestMethod.POST})@ApiOperation(tags = "菜单管理左侧菜单树链接",value = "获取菜单树")public DtreeResult getTree(){DtreeResult result = new DtreeResult();
// 同dtree中status一样设置Map<String,Object> map=new HashMap<>();map.put("code",200);map.put("message","操作成功");result.setStatus(map);
// 同dtree中data一样设置List<TreeNode> nodeList=menuService.getTreeNode();result.setData(nodeList);return result;}
解决Cannot read properties of null (reading ‘code‘)相关推荐
- TypeError: Cannot read properties of null (reading ‘indexOf‘)
问题描述: TypeError: Cannot read properties of null (reading 'indexOf') 意思是:TypeError:无法读取null的属性(读取'ind ...
- [Vue warn]: Error in mount hook: “TypeError: Cannot read properties of null (reading ‘getAttribute‘)
在vue项目中,使用echarts报一下的错误: [Vue warn]: Error in mount hook: "TypeError: Cannot read properties of ...
- 15 flvjs 播放 ws 服务代理的不存在的 rtsp 连接, Cannot read properties of null (reading ‘flushStashedSamples‘)
前言 这是基于 flvjs 播放 rtsp视频服务 基于node+ffmpeg 转换为 flv 视频服务 的时候, 衍生出来的一个问题 在生产环境上面, 很大一部分 rtsp 服务是正常的可以播放的, ...
- 高德地图点聚合插件AMap.MarkerClusterer报错Uncaught TypeError: Cannot read properties of null (reading ‘Md‘)
报错信息:Uncaught TypeError: Cannot read properties of null (reading 'Md') mapscallback=___onAPILoaded&a ...
- TypeError: Cannot read properties of null (reading ‘insertBefore‘)
TypeError: Cannot read properties of null (reading 'insertBefore') vite build vue3之后线上报错! 项目版本 vue3 ...
- 引入echarts的js文件报错——Cannot read properties of null (reading ‘getAttribute‘)
今天在引入echarts.min.js的时候总是报错: 报错如下: 该问题为:无法读取空的属性"获取属性" 根据分析,错误原因有两个: 1.初始化echarts对象不存在 2.js ...
- npm 报错 ERR Cannot read properties of null reading ‘package npm ERR A complete log of this run can
通过npm install 安装依赖报如下错误. 解决办法:尝试通过cnpm install 或yarn install 即可解决.
- 解决Cannot read properties of undefined (reading ‘name ‘)“found in,初次加载报错(user.classmate.name)
<div>{{user.classmate.name}}</div> const { user } = await getUser(this.queryParams) this ...
- vue TypeError: Cannot read properties of null (reading 'insertBefore')
这个错误通常是由于在组件中使用了 insertBefore 方法时,试图插入到一个不存在的父节点导致的.您可以使用 v-if 指令或在 JavaScript 代码中进行 null 值检查来避免这种情况 ...
最新文章
- mysql当前时间减1小时_最佳睡眠时间:晚上睡眠不超8小时,午睡不超1小时
- Unbalanced calls to begin/end appearance transitions for XXXX
- mysql 四 表操作
- 365篇原创后,有三AI喊你正式加入来不来?
- 云炬WEB开发笔记2-7 代理神器CharlesFiddler
- 2016年第一堂课课后作业1
- 重言式判别c语言中文网,重言式判别 重言式判别源码及课程设计 c语言版.doc
- 4大JVM性能分析工具详解,及内存泄漏分析方案
- Linux中的redis集群搭建
- UnhandledPromiseRejectionWarning报错send()的处理
- python经典书籍推荐:Python面向对象编程指南 : Mastering Object-oriented
- 卡住 安装_【书中有路】弹簧式安全阀结构原理、故障解析、安装要点
- linux bash基本特性
- 什么是Android上的“上下文”?
- 【图文】远程桌面链接:这可能是由于credssp加密oracle修正
- 删除root 家目录,及恢复方法
- webstorm 自定义项目模板
- Mac终端神器iTerm2配置(oh-my-zsh+shell integration+Powerlevel9k)
- jetson nano开电源_NVIDIA Jetson Nano开发者套件入门指南
- 阿里云服务器访问windows下网页(内网穿透)