当前位置: 首页 > news >正文

前端如何判空

        这样判空就会报错 

                loadNode(node, resolve)console.log("node")console.log(node)if (node.data !== null) {this.get(ctx + '/publicity/publicityType/typeTreeData?id=' + node.data.id).then((res) => {resolve(res)})}},

        需要这样写,用typeof来做类型判断

                console.log("node")console.log(node)if (typeof node.data !== 'undefined') {this.get(ctx + '/publicity/publicityType/typeTreeData?id='+node.data.id).then((res) => {resolve(res)})}else {this.get(ctx + '/publicity/publicityType/typeTreeData?id='+this.typeId).then((res) => {resolve(res)})}

 

 

http://www.lryc.cn/news/239726.html

相关文章:

  • 基于SSM的焦作旅游协会管理系统设计与实现
  • 庖丁解牛:NIO核心概念与机制详解 07 _ 字符集
  • ansible的基本安装
  • 开发仿抖音APP遇到的问题和解决方案
  • 手机上玩.NET的两种方式
  • DedeBIZ 管理系统 DedeV6 v6.2.6 社区版 免费授权版
  • 编译 CUDA加速的 OpenCV-4.8.0 版本
  • 设计模式篇---外观模式
  • leetcode:520. 检测大写字母
  • 5-6求1-20的阶乘和
  • web需求记录
  • [网鼎杯 2018]Fakebook
  • 微信小程序蓝牙连接 uniApp蓝牙连接设备
  • 启动Dubbo项目注册Zookeeper时提示zookeeper not connected异常原理解析
  • 我在Vscode学OpenCV 几何变换(缩放、翻转、仿射变换、透视、重映射)
  • MATLAB算法实战应用案例精讲-【图像处理】图像缩放
  • Doris的PROPERTIES与ENGINE(九)
  • 华为云数据库 RDS 下载全量备份文件 wget
  • C#使用whisper.net实现语音识别(语音转文本)
  • 从零开始学习typescript——运算符(算术运算符、赋值运算符、比较运算符)
  • likeshop单商户商城系统 任意文件上传漏洞复现
  • CentOS 7 使用pugixml 库
  • 深度学习 loss 是nan的可能原因
  • [ 云计算 | AWS 实践 ] 基于 Amazon S3 协议搭建个人云存储服务
  • 第二十章:多线程
  • CentOS 7启动时报“Started Crash recovery kernel arming.....shutdown....”问题处理过程
  • Android 13 - Media框架(14)- OpenMax(二)
  • 【Python大数据笔记_day11_Hadoop进阶之MR和YARNZooKeeper】
  • 飞桨——总结PPOCRLabel中遇到的坑
  • LeetCode(30)长度最小的子数组【滑动窗口】【中等】