Home  >  Article  >  Web Front-end  >  How to determine whether an object is empty in vue.js

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

coldplay.xixi
coldplay.xixiOriginal
2020-11-12 16:55:444245browse

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)=='{}'

2. Use Object to judge

Object.keys(xxx).length==0

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!

Statement:
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