判断对象中是否有某个属性

2019-11-20  本文已影响0人  执念_6afc

vue中js用来判断对象中是否有某个属性的方法可以直接使用

<p v-if="article.comment.hasOwnProperty('count') && article.comment.count == null">0 Comments</p>

判断comment中是否含有count属性 .hasOwnProperty

上一篇 下一篇

猜你喜欢

热点阅读