Home > Article > Web Front-end > How vue.js determines whether an object has a certain attribute
vue.js method to determine whether an object has a certain attribute: [if(row.hasOwnProperty('url')){//The 'url' attribute of the row object exists}else{//The row object does not exist 'url' attribute}].
The operating environment of this article: windows10 system, vue 2.5.2, thinkpad t480 computer.
How do we determine whether an object has a certain attribute or field in vue?
The judgment method is as follows:
if(row.hasOwnProperty('url')){ //row对象存在'url'属性 }else{ //row对象不存在'url'属性 }
Recommended learning: php training
The above is the detailed content of How vue.js determines whether an object has a certain attribute. For more information, please follow other related articles on the PHP Chinese website!