首页 > 其他分享 >TypeError: Cannot read properties of null (reading 'name')

TypeError: Cannot read properties of null (reading 'name')

时间:2023-05-19 19:11:10浏览次数:40  
标签:TypeError name err read edit loading query null

报错如下:

错误代码:

searchList() {
      this.entity = {}
      this.edit = null
      
      let query = {}
      query.traceCode = this.code
      this.loading = true
      codeApi.queryTraceCode(query).then(res => {
        ...
      }, err => {
        console.error(err)
      }).finally(() => {
        this.loading = false
      })
    },

数据模型:

data() {
    return {
      edit: {
        name: '',
        prepnSpec: null,
        pkgSpec: null,
        expiryTem: null,
        approvalLicenceNo: null,
        produceDate: null,
        expiryDate: null,
        batchNo: null,
        produceEntName: null,

      },

    }
  },

解决办法:

searchList() {
      this.entity = {}
      this.edit = {}
      
      let query = {}
      query.traceCode = this.code
      this.loading = true
      codeApi.queryTraceCode(query).then(res => {
        ...
      }, err => {
        console.error(err)
      }).finally(() => {
        this.loading = false
      })
    },

 

标签:TypeError,name,err,read,edit,loading,query,null
From: https://www.cnblogs.com/zwh0910/p/17416073.html

相关文章

  • TS高级类型 Record、Pick、Partial、Required、Readonly、Exclude、Extract、Omit、No
    keyof获取类型内所有的key,即所有属性名,获取的是一个联合类型这里类型指:通过interface或type定义的类型;通过typeofxxx返回的类型等。keyof后面必须是类型,不能是具体的对象interfaceIPeople{name:string,age?:number,sex:string,}ty......
  • dog二进制输入输出-write和read;
    #include<bits/stdc++.h>usingnamespacestd;classDog{ private: intage; intweight; public: Dog(inta,intb):age(a),weight(b){};//带参数的构造函数; Dog(){};//不带参数的构造函数 intAge(){ returnthis->age; } intWeight() { returnthis->weight; } ~Do......
  • github报错“ssh_exchange_identification: Connection closed by remote host fatal:
    解决方式:不确定是否为密钥过期还是C:\Users\John\.ssh文件夹下的config文件中没有添加github的host。总之,所有的尝试如下:(1)重新生成公钥和私钥。打开gitbash,输入以下命令获取自己github的email。gitconfiguser.email 生成ssh私钥和公钥ssh-keygen-trsa-......
  • 记录浏览器的bug。Cannot read properties of undefined (reading ‘toLowerCase
    UncaughtTypeError:Cannotreadpropertiesofundefined(reading‘toLowerCase发现是浏览器的bug。浏览器会自动保存表单数据,如果填入表单的时候,点击浏览器保存的数据控制台就会报错。 ......
  • ThreadLocal
    早在Java1.2推出之时,Java平台中就引入了一个新的支持:java.lang.ThreadLocal,给我们在编写多线程程序时提供了一种新的选择。使用这个工具类可以很简洁地编写出优美的多线程程序,虽然ThreadLocal非常有用,但是似乎现在了解它、使用它的朋友还不多。ThreadL......
  • 【cplusplus教程翻译】名字可见性(Name visibility)
    作用域(Scopes)命名实体,如变量、函数和复合类型,在C++中使用之前需要声明。程序中发生此声明的点会影响其可见性:在任何块外部声明的实体都具有全局作用域,这意味着其名称在代码中的任何位置都是有效的。而在块内声明的实体,如函数或选择性语句,具有块作用域,并且只能在声明它的特定块内......
  • MySQL数据库数据恢复 -【MySQL ERROR 1050: Table already exists】
     来源:http://www.360doc.com/content/18/0523/15/46399781_756406512.shtml ......
  • vue中pdf预览,报错(Cannot read properties of undefined (reading ‘catch‘))解决
    1、在node_modules中找到vue-pdf,src下的pdfjsWrapper.jsif(pdfRender!==null){if(canceling)return;canceling=true;pdfRender.cancel().catch(function(err){emitEvent('error',err);});return;}修改为if(pdf......
  • 概述 .NET ThreadPool 实现
    基本调度单元IThreadPoolWorkItem实现类的实例。Task全局队列本地队列偷窃机制线程注入实验.NET5实验一默认线程池配置.NET5实验二调整ThreadPool设置.NET5实验三tcs.Task.Wait()改为Thread.Sleep.NET6实验一默认ThreadPoo......
  • RocketMQ源码(三):服务端NameSrv启动流程
    有关Namesrv的概念及功能,详见RocketMQ(三):架构设计中技术架构组成namesrv,这里不再赘述。RocketMQ中Namesrv启动入口:org.apache.rocketmq.namesrv.NamesrvStartup。Namesrv启动,NamesrvStartup#main0()核心伪代码:1publicstaticNamesrvControllermain0(String[......