企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 模板中使用JS表达式 > 不可避免的需要用到, if else 判断 ``` <table class="layui-table" lay-data="{ url:'{:url(\'list\')}', id:'idTest'}" lay-filter="demo"> <thead> <tr> <th lay-data="{templet:'#code'}">类型</th> <th lay-data="{field:'create_time'}">创建时间</th> </tr> </thead> </table> <script type="text/html" id="code"> {{# if (d.code == 'goods') { }} 商品 {{# } else if (d.code == 'homestay') { }} 酒店 {{# } else if (d.code == 'story') { }} 故事 {{# } }} </script> ``` 用 `{{# }}` 把js表达式圈起来