|
一说tp大多数人想到的是PHP使用tp,但今天不说PHP <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>说说c#使用tp <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>由于tp比较久远 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>网上的资料又是少之又少 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>接下来说说tp的一些基本用法
1.首先就是数据绑定了- <%tp:foreach <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>collection="{$model.Items}" <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>var="m"%>
- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><td>{$m.name}</td>
- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><td>{$m.phone}</td>
- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>........
- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><%/tp:foreach%>
复制代码 发现没 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>是不是有点类似Angular <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>关键点就是在于要加 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>结尾
2.条件判断- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><%tp:if <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>test="{$isempty(m.status)}"%>//非空判断
- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>type="button">审核</button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>>
- <%tp:elseif <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>test="{$eq(m.State,"已提交")}"%>//是否等于某值
- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>type="button">审核</button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>>
- <%tp:else%>//剩下的就是其他状态了
- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%><button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>type="button">提交</button <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>>
- <%/tp:if%>
复制代码 其中也不含也包含多条件- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>
复制代码 3.赋值这个就类似于咱们webform中直接取model中的值赋值了 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>但是前提是后台你的将model对象写进去- <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>_template.SetValue("model", <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>result);//model <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%> <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>就是前台页面的赋值名字 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>result就是你获取是数据对象结果
复制代码 剩下的待续........
来源:https://www.cnblogs.com/wuyabaibsd/archive/2023/09/07/17685675.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 <%tp:if test="{$and(eq(m.State,"1"),eq(m.IsDel,"0"))}"%>我们会及时删除侵权内容,谢谢合作! |
|