vue 读取FILE中的数据(变为JSON格式中的代码报错

问题遇到的现象和发生背景

vue hasOwnProperty 这个报错 不知道什么意思 能正常启动

用代码块功能插入代码,请勿粘贴截图
    // 读取FILE中的数据(变为JSON格式
    async handle(ev) {
      const file = ev.raw
      if (!file) return
      let data = await readFile(file)
      const workbook = xlsx.read(data, { type: 'binary' })
      const worsheet = workbook.Sheets[workbook.SheetNames[0]]
      data = xlsx.utils.sheet_to_json(worsheet)

      const arr = []
      data.forEach(item => {
        const obj = {}
        for (const key in character) {
          // if (!character.hasOwnProperty(obj, 'key')) break
          if (!character.hasOwnProperty(key)) break
          let v = character[key]
          const text = v.text
          const type = v.type
          v = item[text] || ''
          type === 'string' ? (v = String(v)) : null
          type === 'string' ? (v = String(v)) : null
          obj[key] = v
        }
        arr.push(obj)
      })
      this.tempData = arr
    },

我想要达到的结果

把这个报错解决

img

img

https://blog.csdn.net/qq_36727756/article/details/105464902

Object.prototype.hasOwnProperty.call(character, 'key')