1
我有剃须刀语法嵌套和混合在HTML和JavaScript。什么是嵌套和混合代码块的正确剃刀语法?
它运行良好,除非我做自动代码格式,}
不断推出。
@section js{
<script type="text/javascript">
$(document).ready(function() {
@if (ViewBag.Searched && ViewBag.Found)
{
@:$('#found').show(); $('#permit-info').show();
@if (ViewBag.PendingRequest)
{
@:$('#request-info').hide(); $('#report-info').show();
}
else
{
@:$('#request-info').show(); $('#report-info').hide();
}
}
else
{
@if (ViewBag.Searched)
{
@:$('#not-found').show();
} // <----- PROBLEM. this } doesn't stay at the right place.
}
});
</script>
}
我删除了,但还是有同样的问题。 – 2013-03-14 15:52:01
@RayCheng我刚刚编辑过,你实际上有两行'@' – mattytommo 2013-03-14 15:52:20
是的,我试了两个。 – 2013-03-14 15:52:41