Can the template string of Es6 be judged by if to dynamically display information?

if the picture is a template, sometimes you want to judge and then show or not show some elements name can be operated in the template engine?
or can we only use js to hide and show
after rendering, or define an empty variable to concatenate and then determine whether it is successful to assign a value to the empty variable?
is there a better way?

Mar.20,2021

The template string for

ES6 is that can nest any expression , and another template string is fine. So it's actually very straightforward:

  

info does not exist. If you give info.realname ='', it will not be displayed, or the corresponding dom? will not be displayed.

Menu