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

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‘)

posted @ 2022-07-08 12:36  rainbow70626  阅读(4918)  评论(0编辑  收藏  举报