随笔 - 754  文章 - 0 评论 - 33 阅读 - 135万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

报错如下:

错误代码:

复制代码
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,

      },

    }
  },
复制代码

问题原因:将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
      })
    },
复制代码

 



感谢您的阅读,如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮。本文欢迎各位转载,但是转载文章之后必须在文章页面中给出作者和原文连接
posted on   周文豪  阅读(2693)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示