vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘)

02-29 阅读 0评论

 在查看信息时,界面没反应,然后查看控制台报错

vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘),vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘),词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,方法,修改,操作,第1张
(图片来源网络,侵删)
index.vue?t=1680763420735:497 Uncaught (in promise) TypeError: 
Cannot read properties of undefined (reading 'comcode')

vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘)

然后查找获取数据的方法

  getInfo(row.id).then((response) => {
    info.value = response.data ;
  });

 f12查看返回数据信息如下:

{msg: "操作成功", code: 200}

因为没有正确返回数据,导致获取response.data时是一个undefined ,因此展示数据的时候就会出错

{{ info.comcode}}

所以修改获取数据的function,然后将获取的数据判断一下,如果为undefined,则赋值一个新对象,否则从data中获取数据

vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘),vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘),词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,方法,修改,操作,第3张
(图片来源网络,侵删)
  getInfo(row.id).then((response) => {
		info.value = response.data === undefined ? {} : response.data;
	});
vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘),vue Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘comcode‘),词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,方法,修改,操作,第4张
(图片来源网络,侵删)

免责声明
本网站所收集的部分公开资料来源于AI生成和互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,人围观)

还没有评论,来说两句吧...

目录[+]