服务热线
400
<input type="radio" name="Statues" value="0" title="正常" lay-filter="Statues" @(Model.Statues == 0 ? "checked" : "")>
<input type="radio" name="Statues" value="1" title="冻结" lay-filter="Statues" @(Model.Statues == 1 ? "checked" : "")>
说明:
@() 的使用:
@() 是 Razor 中用于嵌套表达式的语法,表示动态生成内容。
在这里,我们用它将条件表达式 Model.Statues == 0 ? "checked" : "" 嵌套到 HTML 中。
动态生成属性:
通过 @(条件 ? "属性值" : "") 的形式,可以动态决定是否添加 checked 属性。