Home > Web Front-end > Vue.js > How vue.js determines whether an object has a certain attribute

How vue.js determines whether an object has a certain attribute

王林
Release: 2021-10-08 14:39:07
Original
10507 people have browsed it

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}].

How vue.js determines whether an object has a certain 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'属性
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template