vue中判断数组长度length报错

2020-06-28 10:45:47 浏览数 (1)

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

报错:Error in render: “TypeError: Cannot read property ‘length’ of undefined”

解决办法:

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

0 人点赞