Home > Web Front-end > JS Tutorial > body text

How to determine if el expression is not empty

php中世界最好的语言
Release: 2018-05-08 11:46:22
Original
3049 people have browsed it

This time I will bring you elExpressionHow to determine non-empty, el expression to determine non-emptyWhat are the precautions, the following is a practical case, let’s take a look .

Scenario:

After the page jumps, use spring mvc to pass a json object to the front-end page. After getting it in js, do the processing.

Returned json object:

{"nodes":[{"contactmobile":"15922208502","orderno":"XNH31918062989476864"},{"id":"12198","group":"11","content":"把考虑考虑","modelname":"Company"}],"links":[{"target":"12198","id":"15016","relationType":"公司","source":"12194"}]}
Copy after login
var graph; 
var flag = "${empty jsonData}"; 
if(flag!="true"){ 
  graph = eval('(' + '${jsonData}' + ')'); 
};
Copy after login

There is a note here:

When using el expressions in js, be sure to use quotation marks. If the returned json contains double quotes, then use single quotes to surround the el expression, otherwise, use double quotes.

In addition, pay attention to the writing method of using evalfunction to convert the json string into an object.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of Vue operation custom dynamic component method

How to optimize time-sharing functions in JS

The above is the detailed content of How to determine if el expression is not empty. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!