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

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

coldplay.xixi
Release: 2020-11-12 17:09:52
Original
4418 people have browsed it

vue.js method to judge whether the object is empty: 1. Use json to judge, the code is [JSON.stringify(xxx)=='{}']; 2. Use Object to judge, the code is [Object .keys(xxx).length==0].

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

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

1. Use json to determine

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

2. Use Object to judge

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

The verification results are as follows:

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

##Related free learning recommendations: JavaScript(Video)

The above is the detailed content of How to determine whether 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template