报错如下:

错误代码:

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 2023-05-19 19:08  周文豪  阅读(2622)  评论(0编辑  收藏  举报