0
点赞
收藏
分享

微信扫一扫

Vue3项目运行时报错误:TypeError Cannot read properties of undefined (reading 'filter')

Star英 2022-07-13 阅读 37

let matched = this.$route.mached.filter(item => item.name);方法报错:TypeError Cannot read properties of undefined (reading 'filter')。

 

原因分析:

  这个问题不要慌,要么是打错字了,要么就是忘记传这个字段了,导致了在另一个页面没有找到这个'filter'字段。

  经过仔细检查,确认为:单词拼写错误。matched,错误地写成:mached。以至于运行时报错为:不能读取未定义的属性(读取'filter'属性时)。

 

解决办法:

  将错误的单词mached,拼写为正确的matched,即可解决。

 

参考链接:​​已解决:TypeError: Cannot read properties of undefined (reading ‘value‘)​​



举报

相关推荐

0 条评论