Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘brands)

在写vue项目时我们经常会遇见这种报错, 报错:Uncaught (in promise) TypeError: Cannot read properties of null (reading 'brands') 这句话意思是:无法读取null属性(读取'brands')

 解决办法是在需要渲染的地方加一个v-if来判断数据存在 如下图

搞定!! 

猜你喜欢

转载自blog.csdn.net/qq_59294119/article/details/130391247