vue中判断数组长度length报错

{{pawnList.length>0 ? pawnList.name : ''}}

报错:Error in render: "TypeError: Cannot read property 'length' of undefined"

解决办法:

{{pawnList!== undefined && pawnList.length>0 ? pawnList.name : ''}}

猜你喜欢

转载自blog.csdn.net/a314753967/article/details/84334704