如果不是列表迭代中的元素,则隐藏元素(Hide element if not element in a list iteration)
所以我在2个字段中有2个字符串列表, altText和imagecaption 。 我把它们包裹在一个div中。 我希望在循环的每次迭代中,如果在某些循环中都没有内容,则使div不渲染。 我该怎么做?
30 = COA 30{ wrap = <div class="case-info">|</div> required = 1 30 = TEXT 30{ wrap = <div>|</div> field = altText listNum.splitChar = 10 listNum.stdWrap.data = register:SPLIT_COUNT required = 1 } 40 < .30 40.field = imagecaption }html的输出是这样的:
<div class="case-info"> <div></div> <div></div> </div>So I have 2 list of string in 2 fields, altText and imagecaption. I have them wrapped in a div. I want to make the div not render if neither have content in some loop, on each iteration of the loop. How can I do it?
30 = COA 30{ wrap = <div class="case-info">|</div> required = 1 30 = TEXT 30{ wrap = <div>|</div> field = altText listNum.splitChar = 10 listNum.stdWrap.data = register:SPLIT_COUNT required = 1 } 40 < .30 40.field = imagecaption }The output of html is this:
<div class="case-info"> <div></div> <div></div> </div>最满意答案
删除包装并以这种方式尝试:
30 = COA 30{ stdWrap.required = 1 stdWrap.wrap = <div class="case-info">|</div> 30 = TEXT 30{ field = altText listNum.splitChar = 10 listNum.stdWrap.data = register:SPLIT_COUNT trim = 1 required = 1 wrap = <div>|</div> } 40 < .30 40.field = imagecaption }所以,如果有内容(required = 1),只会执行换行
Remove the wrap and try it this way:
30 = COA 30{ stdWrap.required = 1 stdWrap.wrap = <div class="case-info">|</div> 30 = TEXT 30{ field = altText listNum.splitChar = 10 listNum.stdWrap.data = register:SPLIT_COUNT trim = 1 required = 1 wrap = <div>|</div> } 40 < .30 40.field = imagecaption }so, the wrap will only executed, if there is content (required = 1)
更多推荐
发布评论