Home> Web Front-end> Vue.js> body text

How to determine if an object is empty in vue.js

coldplay.xixi
Release: 2020-11-30 13:39:27
Original
11077 people have browsed it

vue.js method to determine if an object is empty: 1. Convert the object to JSON. If it is an empty collection [{}], then it is an empty object; 2. Determine the length of the object. If it is zero, then it is Empty object.

How to determine if an object is empty in vue.js

The operating environment of this tutorial: windows10 system, vue2.9, this article is applicable to all brands of computers.

【Recommended related articles:vue.js

vue.js method to determine if an object is empty:

Method 1: Convert the object to JSON. If it is an empty collection {}, then it is an empty object.

JSON.stringify(object)=='{}'
Copy after login

Method 2: Determine the length of the object. If it is zero, it is an empty object.

Object.keys(object).length==0
Copy after login

Related free learning recommendations:JavaScript(video)

The above is the detailed content of How to determine if an object is empty in vue.js. 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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!